From 6396a7a425293745b1810566851c17cf08d36985 Mon Sep 17 00:00:00 2001 From: Daniele D'Orazio Date: Wed, 19 Jun 2019 14:56:02 +0200 Subject: [PATCH 1/4] make needless_return work with void functions --- clippy_lints/src/returns.rs | 75 ++++++++++++++++++++++++--------- tests/ui/needless_return.rs | 20 +++++++++ tests/ui/needless_return.stderr | 42 ++++++++++++++---- 3 files changed, 108 insertions(+), 29 deletions(-) diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs index 41cf012ac879f..caeb1e8b9fbb6 100644 --- a/clippy_lints/src/returns.rs +++ b/clippy_lints/src/returns.rs @@ -83,6 +83,12 @@ declare_clippy_lint! { "needless unit expression" } +#[derive(PartialEq, Eq, Copy, Clone)] +enum RetReplacement { + Empty, + Unit +} + declare_lint_pass!(Return => [NEEDLESS_RETURN, LET_AND_RETURN, UNUSED_UNIT]); impl Return { @@ -91,7 +97,7 @@ impl Return { if let Some(stmt) = block.stmts.last() { match stmt.node { ast::StmtKind::Expr(ref expr) | ast::StmtKind::Semi(ref expr) => { - self.check_final_expr(cx, expr, Some(stmt.span)); + self.check_final_expr(cx, expr, Some(stmt.span), RetReplacement::Empty); }, _ => (), } @@ -99,13 +105,13 @@ impl Return { } // Check a the final expression in a block if it's a return. - fn check_final_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr, span: Option) { + fn check_final_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr, span: Option, replacement: RetReplacement) { match expr.node { // simple return is always "bad" - ast::ExprKind::Ret(Some(ref inner)) => { + ast::ExprKind::Ret(ref inner) => { // allow `#[cfg(a)] return a; #[cfg(b)] return b;` if !expr.attrs.iter().any(attr_is_cfg) { - self.emit_return_lint(cx, span.expect("`else return` is not possible"), inner.span); + self.emit_return_lint(cx, span.expect("`else return` is not possible"), inner.as_ref().map(|i| i.span), replacement); } }, // a whole block? check it! @@ -117,32 +123,61 @@ impl Return { // (except for unit type functions) so we don't match it ast::ExprKind::If(_, ref ifblock, Some(ref elsexpr)) => { self.check_block_return(cx, ifblock); - self.check_final_expr(cx, elsexpr, None); + self.check_final_expr(cx, elsexpr, None, RetReplacement::Empty); }, // a match expr, check all arms ast::ExprKind::Match(_, ref arms) => { for arm in arms { - self.check_final_expr(cx, &arm.body, Some(arm.body.span)); + self.check_final_expr(cx, &arm.body, Some(arm.body.span), RetReplacement::Unit); } }, _ => (), } } - fn emit_return_lint(&mut self, cx: &EarlyContext<'_>, ret_span: Span, inner_span: Span) { - if in_external_macro(cx.sess(), inner_span) || in_macro_or_desugar(inner_span) { - return; - } - span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded return statement", |db| { - if let Some(snippet) = snippet_opt(cx, inner_span) { - db.span_suggestion( - ret_span, - "remove `return` as shown", - snippet, - Applicability::MachineApplicable, - ); + fn emit_return_lint(&mut self, cx: &EarlyContext<'_>, ret_span: Span, inner_span: Option, replacement: RetReplacement) { + match inner_span { + Some(inner_span) => { + if in_external_macro(cx.sess(), inner_span) || in_macro_or_desugar(inner_span) { + return; + } + + span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded return statement", |db| { + if let Some(snippet) = snippet_opt(cx, inner_span) { + db.span_suggestion( + ret_span, + "remove `return` as shown", + snippet, + Applicability::MachineApplicable, + ); + } + }) + }, + None => { + match replacement { + RetReplacement::Empty => { + span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded return statement", |db| { + db.span_suggestion( + ret_span, + "remove `return`", + String::new(), + Applicability::MachineApplicable, + ); + }); + } + RetReplacement::Unit => { + span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded return statement", |db| { + db.span_suggestion( + ret_span, + "replace `return` with the unit type `()`", + "()".to_string(), + Applicability::MachineApplicable, + ); + }); + } + } } - }); + } } // Check for "let x = EXPR; x" @@ -195,7 +230,7 @@ impl EarlyLintPass for Return { fn check_fn(&mut self, cx: &EarlyContext<'_>, kind: FnKind<'_>, decl: &ast::FnDecl, span: Span, _: ast::NodeId) { match kind { FnKind::ItemFn(.., block) | FnKind::Method(.., block) => self.check_block_return(cx, block), - FnKind::Closure(body) => self.check_final_expr(cx, body, Some(body.span)), + FnKind::Closure(body) => self.check_final_expr(cx, body, Some(body.span), RetReplacement::Empty), } if_chain! { if let ast::FunctionRetTy::Ty(ref ty) = decl.output; diff --git a/tests/ui/needless_return.rs b/tests/ui/needless_return.rs index 939233dbecb3a..bc6072202b59b 100644 --- a/tests/ui/needless_return.rs +++ b/tests/ui/needless_return.rs @@ -1,5 +1,9 @@ #![warn(clippy::needless_return)] +macro_rules! the_answer { + () => (42) +} + fn test_end_of_fn() -> bool { if true { // no error! @@ -36,6 +40,22 @@ fn test_closure() { let _ = || return true; } +fn test_macro_call() -> i32 { + return the_answer!(); +} + +fn test_void_fun() { + return; +} + +fn test_void_if_fun(b: bool) { + if b { + return; + } else { + return; + } +} + fn main() { let _ = test_end_of_fn(); let _ = test_no_semicolon(); diff --git a/tests/ui/needless_return.stderr b/tests/ui/needless_return.stderr index d7132ce495093..71646f32dfb99 100644 --- a/tests/ui/needless_return.stderr +++ b/tests/ui/needless_return.stderr @@ -1,5 +1,5 @@ error: unneeded return statement - --> $DIR/needless_return.rs:8:5 + --> $DIR/needless_return.rs:12:5 | LL | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` @@ -7,46 +7,70 @@ LL | return true; = note: `-D clippy::needless-return` implied by `-D warnings` error: unneeded return statement - --> $DIR/needless_return.rs:12:5 + --> $DIR/needless_return.rs:16:5 | LL | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> $DIR/needless_return.rs:17:9 + --> $DIR/needless_return.rs:21:9 | LL | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> $DIR/needless_return.rs:19:9 + --> $DIR/needless_return.rs:23:9 | LL | return false; | ^^^^^^^^^^^^^ help: remove `return` as shown: `false` error: unneeded return statement - --> $DIR/needless_return.rs:25:17 + --> $DIR/needless_return.rs:29:17 | LL | true => return false, | ^^^^^^^^^^^^ help: remove `return` as shown: `false` error: unneeded return statement - --> $DIR/needless_return.rs:27:13 + --> $DIR/needless_return.rs:31:13 | LL | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> $DIR/needless_return.rs:34:9 + --> $DIR/needless_return.rs:38:9 | LL | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> $DIR/needless_return.rs:36:16 + --> $DIR/needless_return.rs:40:16 | LL | let _ = || return true; | ^^^^^^^^^^^ help: remove `return` as shown: `true` -error: aborting due to 8 previous errors +error: unneeded return statement + --> $DIR/needless_return.rs:44:5 + | +LL | return the_answer!(); + | ^^^^^^^^^^^^^^^^^^^^^ + +error: unneeded return statement + --> $DIR/needless_return.rs:48:5 + | +LL | return; + | ^^^^^^^ help: remove `return` + +error: unneeded return statement + --> $DIR/needless_return.rs:53:9 + | +LL | return; + | ^^^^^^^ help: remove `return` + +error: unneeded return statement + --> $DIR/needless_return.rs:55:9 + | +LL | return; + | ^^^^^^^ help: remove `return` + +error: aborting due to 12 previous errors From e1a78ae5287803ee8b29350e5e1f694166f3320c Mon Sep 17 00:00:00 2001 From: Daniele D'Orazio Date: Thu, 20 Jun 2019 13:44:00 +0200 Subject: [PATCH 2/4] update tests and fix lints in clippy --- clippy_lints/src/invalid_ref.rs | 1 - clippy_lints/src/methods/mod.rs | 11 +++--- clippy_lints/src/non_expressive_names.rs | 4 ++- .../src/redundant_pattern_matching.rs | 4 --- tests/compile-test.rs | 4 +-- tests/missing-test-files.rs | 2 +- tests/ui/needless_return.rs | 11 +++++- tests/ui/needless_return.stderr | 34 +++++++++---------- 8 files changed, 38 insertions(+), 33 deletions(-) diff --git a/clippy_lints/src/invalid_ref.rs b/clippy_lints/src/invalid_ref.rs index af100f4c41d9a..8f9ccaea26d21 100644 --- a/clippy_lints/src/invalid_ref.rs +++ b/clippy_lints/src/invalid_ref.rs @@ -51,6 +51,5 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidRef { span_help_and_lint(cx, INVALID_REF, expr.span, msg, HELP); } } - return; } } diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index 1bcdbfec59003..f4019d9a07080 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -1648,16 +1648,15 @@ fn lint_unnecessary_fold(cx: &LateContext<'_, '_>, expr: &hir::Expr, fold_args: ); // Check if the first argument to .fold is a suitable literal - match fold_args[1].node { - hir::ExprKind::Lit(ref lit) => match lit.node { + if let hir::ExprKind::Lit(ref lit) = fold_args[1].node { + match lit.node { ast::LitKind::Bool(false) => check_fold_with_op(cx, fold_args, hir::BinOpKind::Or, "any", true), ast::LitKind::Bool(true) => check_fold_with_op(cx, fold_args, hir::BinOpKind::And, "all", true), ast::LitKind::Int(0, _) => check_fold_with_op(cx, fold_args, hir::BinOpKind::Add, "sum", false), ast::LitKind::Int(1, _) => check_fold_with_op(cx, fold_args, hir::BinOpKind::Mul, "product", false), - _ => return, - }, - _ => return, - }; + _ => (), + } + } } fn lint_iter_nth<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &hir::Expr, iter_args: &'tcx [hir::Expr], is_mut: bool) { diff --git a/clippy_lints/src/non_expressive_names.rs b/clippy_lints/src/non_expressive_names.rs index cc0192feb5cb4..a8c45166a8b35 100644 --- a/clippy_lints/src/non_expressive_names.rs +++ b/clippy_lints/src/non_expressive_names.rs @@ -169,7 +169,9 @@ impl<'a, 'tcx, 'b> SimilarNamesNameVisitor<'a, 'tcx, 'b> { .any(|id| id.name == ident.name) { return; - } else if let Some(scope) = &mut self.0.single_char_names.last_mut() { + } + + if let Some(scope) = &mut self.0.single_char_names.last_mut() { scope.push(ident); } } diff --git a/clippy_lints/src/redundant_pattern_matching.rs b/clippy_lints/src/redundant_pattern_matching.rs index fe1a29b98833c..a178db3132300 100644 --- a/clippy_lints/src/redundant_pattern_matching.rs +++ b/clippy_lints/src/redundant_pattern_matching.rs @@ -95,8 +95,6 @@ fn find_sugg_for_if_let<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, ); }, ); - } else { - return; } } @@ -161,8 +159,6 @@ fn find_sugg_for_match<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, o }, ); } - } else { - return; } } diff --git a/tests/compile-test.rs b/tests/compile-test.rs index e0b1ebf4b8b8f..1631a607e0e09 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -141,11 +141,11 @@ fn run_ui_toml() { let res = run_ui_toml_tests(&config, tests); match res { - Ok(true) => {}, + Ok(true) => {} Ok(false) => panic!("Some tests failed"), Err(e) => { println!("I/O failure during tests: {:?}", e); - }, + } } } diff --git a/tests/missing-test-files.rs b/tests/missing-test-files.rs index d87bb4be3c3f9..a26f43d0eff9f 100644 --- a/tests/missing-test-files.rs +++ b/tests/missing-test-files.rs @@ -46,7 +46,7 @@ fn explore_directory(dir: &Path) -> Vec { if file_stem != current_file { missing_files.push(path.to_str().unwrap().to_string()); } - }, + } _ => continue, }; } diff --git a/tests/ui/needless_return.rs b/tests/ui/needless_return.rs index bc6072202b59b..e9f064ea3efe3 100644 --- a/tests/ui/needless_return.rs +++ b/tests/ui/needless_return.rs @@ -1,7 +1,9 @@ #![warn(clippy::needless_return)] macro_rules! the_answer { - () => (42) + () => { + 42 + }; } fn test_end_of_fn() -> bool { @@ -56,6 +58,13 @@ fn test_void_if_fun(b: bool) { } } +fn test_void_match(x: u32) { + match x { + 0 => (), + _ => return, + } +} + fn main() { let _ = test_end_of_fn(); let _ = test_no_semicolon(); diff --git a/tests/ui/needless_return.stderr b/tests/ui/needless_return.stderr index 71646f32dfb99..88dc5252fb88f 100644 --- a/tests/ui/needless_return.stderr +++ b/tests/ui/needless_return.stderr @@ -1,5 +1,5 @@ error: unneeded return statement - --> $DIR/needless_return.rs:12:5 + --> $DIR/needless_return.rs:14:5 | LL | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` @@ -7,70 +7,70 @@ LL | return true; = note: `-D clippy::needless-return` implied by `-D warnings` error: unneeded return statement - --> $DIR/needless_return.rs:16:5 + --> $DIR/needless_return.rs:18:5 | LL | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> $DIR/needless_return.rs:21:9 + --> $DIR/needless_return.rs:23:9 | LL | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> $DIR/needless_return.rs:23:9 + --> $DIR/needless_return.rs:25:9 | LL | return false; | ^^^^^^^^^^^^^ help: remove `return` as shown: `false` error: unneeded return statement - --> $DIR/needless_return.rs:29:17 + --> $DIR/needless_return.rs:31:17 | LL | true => return false, | ^^^^^^^^^^^^ help: remove `return` as shown: `false` error: unneeded return statement - --> $DIR/needless_return.rs:31:13 + --> $DIR/needless_return.rs:33:13 | LL | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> $DIR/needless_return.rs:38:9 + --> $DIR/needless_return.rs:40:9 | LL | return true; | ^^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> $DIR/needless_return.rs:40:16 + --> $DIR/needless_return.rs:42:16 | LL | let _ = || return true; | ^^^^^^^^^^^ help: remove `return` as shown: `true` error: unneeded return statement - --> $DIR/needless_return.rs:44:5 - | -LL | return the_answer!(); - | ^^^^^^^^^^^^^^^^^^^^^ - -error: unneeded return statement - --> $DIR/needless_return.rs:48:5 + --> $DIR/needless_return.rs:50:5 | LL | return; | ^^^^^^^ help: remove `return` error: unneeded return statement - --> $DIR/needless_return.rs:53:9 + --> $DIR/needless_return.rs:55:9 | LL | return; | ^^^^^^^ help: remove `return` error: unneeded return statement - --> $DIR/needless_return.rs:55:9 + --> $DIR/needless_return.rs:57:9 | LL | return; | ^^^^^^^ help: remove `return` +error: unneeded return statement + --> $DIR/needless_return.rs:64:14 + | +LL | _ => return, + | ^^^^^^ help: replace `return` with the unit type `()`: `()` + error: aborting due to 12 previous errors From 66dbc02b0594cc2bab953b8f821e3d1562436475 Mon Sep 17 00:00:00 2001 From: Daniele D'Orazio Date: Fri, 21 Jun 2019 14:46:34 +0200 Subject: [PATCH 3/4] more idiomatic code --- clippy_lints/src/returns.rs | 74 +++++++++++++++++++-------------- tests/ui/needless_return.stderr | 18 ++++---- 2 files changed, 51 insertions(+), 41 deletions(-) diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs index caeb1e8b9fbb6..2245b719c23bb 100644 --- a/clippy_lints/src/returns.rs +++ b/clippy_lints/src/returns.rs @@ -86,7 +86,7 @@ declare_clippy_lint! { #[derive(PartialEq, Eq, Copy, Clone)] enum RetReplacement { Empty, - Unit + Unit, } declare_lint_pass!(Return => [NEEDLESS_RETURN, LET_AND_RETURN, UNUSED_UNIT]); @@ -105,13 +105,24 @@ impl Return { } // Check a the final expression in a block if it's a return. - fn check_final_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr, span: Option, replacement: RetReplacement) { + fn check_final_expr( + &mut self, + cx: &EarlyContext<'_>, + expr: &ast::Expr, + span: Option, + replacement: RetReplacement, + ) { match expr.node { // simple return is always "bad" ast::ExprKind::Ret(ref inner) => { // allow `#[cfg(a)] return a; #[cfg(b)] return b;` if !expr.attrs.iter().any(attr_is_cfg) { - self.emit_return_lint(cx, span.expect("`else return` is not possible"), inner.as_ref().map(|i| i.span), replacement); + self.emit_return_lint( + cx, + span.expect("`else return` is not possible"), + inner.as_ref().map(|i| i.span), + replacement, + ); } }, // a whole block? check it! @@ -135,7 +146,13 @@ impl Return { } } - fn emit_return_lint(&mut self, cx: &EarlyContext<'_>, ret_span: Span, inner_span: Option, replacement: RetReplacement) { + fn emit_return_lint( + &mut self, + cx: &EarlyContext<'_>, + ret_span: Span, + inner_span: Option, + replacement: RetReplacement, + ) { match inner_span { Some(inner_span) => { if in_external_macro(cx.sess(), inner_span) || in_macro_or_desugar(inner_span) { @@ -144,39 +161,32 @@ impl Return { span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded return statement", |db| { if let Some(snippet) = snippet_opt(cx, inner_span) { + db.span_suggestion(ret_span, "remove `return`", snippet, Applicability::MachineApplicable); + } + }) + }, + None => match replacement { + RetReplacement::Empty => { + span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded return statement", |db| { db.span_suggestion( ret_span, - "remove `return` as shown", - snippet, + "remove `return`", + String::new(), Applicability::MachineApplicable, ); - } - }) + }); + }, + RetReplacement::Unit => { + span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded return statement", |db| { + db.span_suggestion( + ret_span, + "replace `return` with the unit type", + "()".to_string(), + Applicability::MachineApplicable, + ); + }); + }, }, - None => { - match replacement { - RetReplacement::Empty => { - span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded return statement", |db| { - db.span_suggestion( - ret_span, - "remove `return`", - String::new(), - Applicability::MachineApplicable, - ); - }); - } - RetReplacement::Unit => { - span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded return statement", |db| { - db.span_suggestion( - ret_span, - "replace `return` with the unit type `()`", - "()".to_string(), - Applicability::MachineApplicable, - ); - }); - } - } - } } } diff --git a/tests/ui/needless_return.stderr b/tests/ui/needless_return.stderr index 88dc5252fb88f..7858ecfba9787 100644 --- a/tests/ui/needless_return.stderr +++ b/tests/ui/needless_return.stderr @@ -2,7 +2,7 @@ error: unneeded return statement --> $DIR/needless_return.rs:14:5 | LL | return true; - | ^^^^^^^^^^^^ help: remove `return` as shown: `true` + | ^^^^^^^^^^^^ help: remove `return`: `true` | = note: `-D clippy::needless-return` implied by `-D warnings` @@ -10,43 +10,43 @@ error: unneeded return statement --> $DIR/needless_return.rs:18:5 | LL | return true; - | ^^^^^^^^^^^^ help: remove `return` as shown: `true` + | ^^^^^^^^^^^^ help: remove `return`: `true` error: unneeded return statement --> $DIR/needless_return.rs:23:9 | LL | return true; - | ^^^^^^^^^^^^ help: remove `return` as shown: `true` + | ^^^^^^^^^^^^ help: remove `return`: `true` error: unneeded return statement --> $DIR/needless_return.rs:25:9 | LL | return false; - | ^^^^^^^^^^^^^ help: remove `return` as shown: `false` + | ^^^^^^^^^^^^^ help: remove `return`: `false` error: unneeded return statement --> $DIR/needless_return.rs:31:17 | LL | true => return false, - | ^^^^^^^^^^^^ help: remove `return` as shown: `false` + | ^^^^^^^^^^^^ help: remove `return`: `false` error: unneeded return statement --> $DIR/needless_return.rs:33:13 | LL | return true; - | ^^^^^^^^^^^^ help: remove `return` as shown: `true` + | ^^^^^^^^^^^^ help: remove `return`: `true` error: unneeded return statement --> $DIR/needless_return.rs:40:9 | LL | return true; - | ^^^^^^^^^^^^ help: remove `return` as shown: `true` + | ^^^^^^^^^^^^ help: remove `return`: `true` error: unneeded return statement --> $DIR/needless_return.rs:42:16 | LL | let _ = || return true; - | ^^^^^^^^^^^ help: remove `return` as shown: `true` + | ^^^^^^^^^^^ help: remove `return`: `true` error: unneeded return statement --> $DIR/needless_return.rs:50:5 @@ -70,7 +70,7 @@ error: unneeded return statement --> $DIR/needless_return.rs:64:14 | LL | _ => return, - | ^^^^^^ help: replace `return` with the unit type `()`: `()` + | ^^^^^^ help: replace `return` with the unit type: `()` error: aborting due to 12 previous errors From 316a9f271153830afe928df927bd5cad12a87c74 Mon Sep 17 00:00:00 2001 From: Daniele D'Orazio Date: Fri, 21 Jun 2019 16:47:34 +0200 Subject: [PATCH 4/4] cargo fmt --- tests/compile-test.rs | 4 ++-- tests/missing-test-files.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/compile-test.rs b/tests/compile-test.rs index 1631a607e0e09..e0b1ebf4b8b8f 100644 --- a/tests/compile-test.rs +++ b/tests/compile-test.rs @@ -141,11 +141,11 @@ fn run_ui_toml() { let res = run_ui_toml_tests(&config, tests); match res { - Ok(true) => {} + Ok(true) => {}, Ok(false) => panic!("Some tests failed"), Err(e) => { println!("I/O failure during tests: {:?}", e); - } + }, } } diff --git a/tests/missing-test-files.rs b/tests/missing-test-files.rs index a26f43d0eff9f..d87bb4be3c3f9 100644 --- a/tests/missing-test-files.rs +++ b/tests/missing-test-files.rs @@ -46,7 +46,7 @@ fn explore_directory(dir: &Path) -> Vec { if file_stem != current_file { missing_files.push(path.to_str().unwrap().to_string()); } - } + }, _ => continue, }; }