@@ -56,16 +56,16 @@ impl PathKind {
56
56
57
57
impl SearchPath {
58
58
pub fn from_cli_opt ( path : & str , output : config:: ErrorOutputType ) -> Self {
59
- let ( kind, path) = if path. starts_with ( "native=" ) {
60
- ( PathKind :: Native , & path [ "native=" . len ( ) .. ] )
61
- } else if path. starts_with ( "crate=" ) {
62
- ( PathKind :: Crate , & path [ "crate=" . len ( ) .. ] )
63
- } else if path. starts_with ( "dependency=" ) {
64
- ( PathKind :: Dependency , & path [ "dependency=" . len ( ) .. ] )
65
- } else if path. starts_with ( "framework=" ) {
66
- ( PathKind :: Framework , & path [ "framework=" . len ( ) .. ] )
67
- } else if path. starts_with ( "all=" ) {
68
- ( PathKind :: All , & path [ "all=" . len ( ) .. ] )
59
+ let ( kind, path) = if let Some ( stripped ) = path. strip_prefix ( "native=" ) {
60
+ ( PathKind :: Native , stripped )
61
+ } else if let Some ( stripped ) = path. strip_prefix ( "crate=" ) {
62
+ ( PathKind :: Crate , stripped )
63
+ } else if let Some ( stripped ) = path. strip_prefix ( "dependency=" ) {
64
+ ( PathKind :: Dependency , stripped )
65
+ } else if let Some ( stripped ) = path. strip_prefix ( "framework=" ) {
66
+ ( PathKind :: Framework , stripped )
67
+ } else if let Some ( stripped ) = path. strip_prefix ( "all=" ) {
68
+ ( PathKind :: All , stripped )
69
69
} else {
70
70
( PathKind :: All , path)
71
71
} ;
0 commit comments