File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,7 +100,8 @@ impl std::str::FromStr for CrateSpec {
100100
101101 fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
102102 fn is_crate ( s : & str ) -> bool {
103- !s. contains ( |cc : char | !cc. is_alphabetic ( ) && cc != '-' && cc != '_' )
103+ s. starts_with ( |cc : char | cc. is_alphabetic ( ) || cc == '_' )
104+ && !s. contains ( |cc : char | !cc. is_alphanumeric ( ) && cc != '-' && cc != '_' )
104105 }
105106
106107 fn convert ( s : & str ) -> Option < CrateSpec > {
Original file line number Diff line number Diff line change @@ -159,7 +159,8 @@ impl<'de> Deserialize<'de> for CrateName {
159159}
160160
161161fn is_crate ( s : & str ) -> bool {
162- !s. contains ( |cc : char | !cc. is_alphanumeric ( ) && cc != '_' && cc != '-' )
162+ s. starts_with ( |cc : char | cc. is_alphabetic ( ) || cc == '_' )
163+ && !s. contains ( |cc : char | !cc. is_alphanumeric ( ) && cc != '_' && cc != '-' )
163164}
164165
165166#[ derive( Deserialize ) ]
You can’t perform that action at this time.
0 commit comments