@@ -149,7 +149,7 @@ pub struct Paths {
149149/// ```
150150/// Paths are yielded in alphabetical order.
151151pub fn glob ( pattern : & str ) -> Result < Paths , PatternError > {
152- glob_with ( pattern, & MatchOptions :: new ( ) )
152+ glob_with ( pattern, MatchOptions :: new ( ) )
153153}
154154
155155/// Return an iterator that produces all the `Path`s that match the given
@@ -165,7 +165,7 @@ pub fn glob(pattern: &str) -> Result<Paths, PatternError> {
165165/// passed to this function.
166166///
167167/// Paths are yielded in alphabetical order.
168- pub fn glob_with ( pattern : & str , options : & MatchOptions )
168+ pub fn glob_with ( pattern : & str , options : MatchOptions )
169169 -> Result < Paths , PatternError > {
170170 #[ cfg( windows) ]
171171 fn check_windows_verbatim ( p : & Path ) -> bool {
@@ -222,13 +222,13 @@ pub fn glob_with(pattern: &str, options: &MatchOptions)
222222 return Ok ( Paths {
223223 dir_patterns : Vec :: new ( ) ,
224224 require_dir : false ,
225- options : options . clone ( ) ,
225+ options,
226226 todo : Vec :: new ( ) ,
227227 scope : None ,
228228 } ) ;
229229 }
230230
231- let scope = root. map ( to_scope ) . unwrap_or_else ( || PathBuf :: from ( "." ) ) ;
231+ let scope = root. map_or_else ( || PathBuf :: from ( "." ) , to_scope ) ;
232232
233233 let mut dir_patterns = Vec :: new ( ) ;
234234 let components = pattern[ cmp:: min ( root_len, pattern. len ( ) ) ..]
@@ -253,7 +253,7 @@ pub fn glob_with(pattern: &str, options: &MatchOptions)
253253 Ok ( Paths {
254254 dir_patterns,
255255 require_dir,
256- options : options . clone ( ) ,
256+ options,
257257 todo,
258258 scope : Some ( scope) ,
259259 } )
@@ -333,7 +333,7 @@ impl Iterator for Paths {
333333 & self . dir_patterns ,
334334 0 ,
335335 & scope,
336- & self . options ) ;
336+ self . options ) ;
337337 }
338338 }
339339
@@ -373,7 +373,7 @@ impl Iterator for Paths {
373373 & self . dir_patterns ,
374374 next,
375375 & path,
376- & self . options ) ;
376+ self . options ) ;
377377
378378 if next == self . dir_patterns . len ( ) - 1 {
379379 // pattern ends in recursive pattern, so return this
@@ -402,7 +402,7 @@ impl Iterator for Paths {
402402 None => continue ,
403403 Some ( x) => x
404404 }
405- } , & self . options ) {
405+ } , self . options ) {
406406 if idx == self . dir_patterns . len ( ) - 1 {
407407 // it is not possible for a pattern to match a directory
408408 // *AND* its children so we don't need to check the
@@ -413,7 +413,7 @@ impl Iterator for Paths {
413413 }
414414 } else {
415415 fill_todo ( & mut self . todo , & self . dir_patterns ,
416- idx + 1 , & path, & self . options ) ;
416+ idx + 1 , & path, self . options ) ;
417417 }
418418 }
419419 }
@@ -674,7 +674,7 @@ impl Pattern {
674674 /// assert!(Pattern::new("d*g").unwrap().matches("doog"));
675675 /// ```
676676 pub fn matches ( & self , str : & str ) -> bool {
677- self . matches_with ( str, & MatchOptions :: new ( ) )
677+ self . matches_with ( str, MatchOptions :: new ( ) )
678678 }
679679
680680 /// Return if the given `Path`, when converted to a `str`, matches this
@@ -686,13 +686,13 @@ impl Pattern {
686686
687687 /// Return if the given `str` matches this `Pattern` using the specified
688688 /// match options.
689- pub fn matches_with ( & self , str : & str , options : & MatchOptions ) -> bool {
689+ pub fn matches_with ( & self , str : & str , options : MatchOptions ) -> bool {
690690 self . matches_from ( true , str. chars ( ) , 0 , options) == Match
691691 }
692692
693693 /// Return if the given `Path`, when converted to a `str`, matches this
694694 /// `Pattern` using the specified match options.
695- pub fn matches_path_with ( & self , path : & Path , options : & MatchOptions ) -> bool {
695+ pub fn matches_path_with ( & self , path : & Path , options : MatchOptions ) -> bool {
696696 // FIXME (#9639): This needs to handle non-utf8 paths
697697 path. to_str ( ) . map_or ( false , |s| self . matches_with ( s, options) )
698698 }
@@ -706,7 +706,7 @@ impl Pattern {
706706 mut follows_separator : bool ,
707707 mut file : std:: str:: Chars ,
708708 i : usize ,
709- options : & MatchOptions )
709+ options : MatchOptions )
710710 -> MatchResult {
711711
712712 for ( ti, token) in self . tokens [ i..] . iter ( ) . enumerate ( ) {
@@ -786,7 +786,7 @@ fn fill_todo(todo: &mut Vec<Result<(PathBuf, usize), GlobError>>,
786786 patterns : & [ Pattern ] ,
787787 idx : usize ,
788788 path : & Path ,
789- options : & MatchOptions ) {
789+ options : MatchOptions ) {
790790 // convert a pattern that's just many Char(_) to a string
791791 fn pattern_as_str ( pattern : & Pattern ) -> Option < String > {
792792 let mut s = String :: new ( ) ;
@@ -891,7 +891,7 @@ fn parse_char_specifiers(s: &[char]) -> Vec<CharSpecifier> {
891891 cs
892892}
893893
894- fn in_char_specifiers ( specifiers : & [ CharSpecifier ] , c : char , options : & MatchOptions ) -> bool {
894+ fn in_char_specifiers ( specifiers : & [ CharSpecifier ] , c : char , options : MatchOptions ) -> bool {
895895
896896 for & specifier in specifiers. iter ( ) {
897897 match specifier {
0 commit comments