File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -46,17 +46,11 @@ impl EarlyLintPass for NonReentrantFunctions {
46
46
fn is_reentrant_fn ( func : & Expr ) -> bool {
47
47
match & func. kind {
48
48
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 {
50
50
return false ;
51
51
}
52
- let ident = format ! ( "{:?}" , segments[ 1 ] . ident) ;
53
- check_reentrant_by_fn_name ( & ident)
52
+ matches ! ( segments[ 1 ] . ident. as_str( ) , "strtok" | "localtime" )
54
53
} ,
55
54
_ => false ,
56
55
}
57
56
}
58
-
59
- fn check_reentrant_by_fn_name ( func : & str ) -> bool {
60
- let name = func. split ( '#' ) . next ( ) . unwrap ( ) ;
61
- name == "strtok" || name == "localtime"
62
- }
You can’t perform that action at this time.
0 commit comments