@@ -56,16 +56,16 @@ impl PathKind {
5656
5757impl SearchPath {
5858 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 )
6969 } else {
7070 ( PathKind :: All , path)
7171 } ;
0 commit comments