Skip to content

Commit 9845b3a

Browse files
committed
improve implementation by dogfood
Signed-off-by: mojave2 <0109chenchen@gmail.com>
1 parent a3a1415 commit 9845b3a

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

clippy_lints/src/non_reentrant_functions.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,10 @@ impl EarlyLintPass for NonReentrantFunctions {
3535

3636
let msg: &str = "consider using the reentrant version of the function";
3737

38-
match expr.kind {
39-
ExprKind::Call(ref func, _) => {
40-
if is_reentrant_fn(func) {
41-
span_lint(cx, NON_REENTRANT_FUNCTIONS, expr.span, msg);
42-
}
43-
},
44-
_ => {},
38+
if let ExprKind::Call(func, _) = &expr.kind {
39+
if is_reentrant_fn(func) {
40+
span_lint(cx, NON_REENTRANT_FUNCTIONS, expr.span, msg);
41+
}
4542
}
4643
}
4744
}
@@ -58,6 +55,6 @@ fn is_reentrant_fn(func: &Expr) -> bool {
5855
}
5956

6057
fn check_reentrant_by_fn_name(func: &str) -> bool {
61-
let name = func.split("#").next().unwrap();
58+
let name = func.split('#').next().unwrap();
6259
name == "strtok" || name == "localtime"
6360
}

0 commit comments

Comments
 (0)