Skip to content

Commit 9cd4b13

Browse files
committed
update_lint non_reentrant_functions
Signed-off-by: mojave2 <[email protected]>
1 parent c900d4a commit 9cd4b13

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

clippy_lints/src/non_reentrant_functions.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,11 @@ impl EarlyLintPass for NonReentrantFunctions {
4646
fn is_reentrant_fn(func: &Expr) -> bool {
4747
match &func.kind {
4848
ExprKind::Path(_, Path { segments, .. }) => {
49-
if segments.len() != 2 || !format!("{:?}", segments[0].ident).starts_with("libc#") {
49+
if segments.len() != 2 || segments[0].ident.name != rustc_span::sym::libc {
5050
return false;
5151
}
52-
let ident = format!("{:?}", segments[1].ident);
53-
check_reentrant_by_fn_name(&ident)
52+
matches!(segments[1].ident.as_str(), "strtok" | "localtime")
5453
},
5554
_ => false,
5655
}
5756
}
58-
59-
fn check_reentrant_by_fn_name(func: &str) -> bool {
60-
let name = func.split('#').next().unwrap();
61-
name == "strtok" || name == "localtime"
62-
}

0 commit comments

Comments
 (0)