@@ -107,7 +107,7 @@ impl AnalyzeArgs {
107107 }
108108 } else {
109109 let source_root = source_path. parent ( ) . unwrap ( ) ;
110- if self . skip ( source_path, & mut seen_mark) {
110+ if self . should_skip ( source_path, & mut seen_mark) {
111111 continue ;
112112 }
113113 self . analyze_file_with_context ( source_root, source_path, loader, & mut seen_mark) ?;
@@ -145,7 +145,7 @@ impl AnalyzeArgs {
145145 ) -> anyhow:: Result < ( ) > {
146146 let mut file_status = FileStatusLogger :: new ( source_path, self . verbose ) ;
147147
148- if self . skip ( source_path, seen_mark) {
148+ if self . should_skip ( source_path, seen_mark) {
149149 file_status. info ( "skipped" ) ?;
150150 return Ok ( ( ) ) ;
151151 }
@@ -237,18 +237,20 @@ impl AnalyzeArgs {
237237 Ok ( ( ) )
238238 }
239239
240- fn skip ( & self , path : & Path , seen_mark : & mut bool ) -> bool {
240+ /// Determines if a path should be skipped because we have not seen the
241+ /// continue_from mark yet. The `seen_mark` parameter is necessary to keep
242+ /// track of the mark between the calls in one run.
243+ fn should_skip ( & self , path : & Path , seen_mark : & mut bool ) -> bool {
241244 if * seen_mark {
242- false
243- } else if let Some ( mark) = & self . continue_from {
244- if path != mark {
245- true
246- } else {
247- * seen_mark = true ;
248- false
245+ return false ; // return early and skip match
246+ }
247+ if let Some ( mark) = & self . continue_from {
248+ if path == mark {
249+ * seen_mark = true ; // this is the mark, we have seen it
249250 }
250251 } else {
251- false
252+ * seen_mark = true ; // early return from now on
252253 }
254+ return !* seen_mark; // skip if we haven't seen the mark yet
253255 }
254256}
0 commit comments