1
1
use clippy_config:: Conf ;
2
2
use clippy_utils:: diagnostics:: { span_lint_and_sugg, span_lint_hir_and_then} ;
3
- use clippy_utils:: eq_expr_value;
4
3
use clippy_utils:: msrvs:: { self , Msrv } ;
5
4
use clippy_utils:: source:: SpanRangeExt ;
6
5
use clippy_utils:: sugg:: Sugg ;
7
6
use clippy_utils:: ty:: { implements_trait, is_type_diagnostic_item} ;
7
+ use clippy_utils:: { eq_expr_value, sym} ;
8
8
use rustc_ast:: ast:: LitKind ;
9
9
use rustc_attr_data_structures:: RustcVersion ;
10
10
use rustc_errors:: Applicability ;
@@ -13,7 +13,7 @@ use rustc_hir::{BinOpKind, Body, Expr, ExprKind, FnDecl, UnOp};
13
13
use rustc_lint:: { LateContext , LateLintPass , Level } ;
14
14
use rustc_session:: impl_lint_pass;
15
15
use rustc_span:: def_id:: LocalDefId ;
16
- use rustc_span:: { Span , SyntaxContext , sym } ;
16
+ use rustc_span:: { Span , Symbol , SyntaxContext } ;
17
17
18
18
declare_clippy_lint ! {
19
19
/// ### What it does
@@ -73,10 +73,10 @@ declare_clippy_lint! {
73
73
}
74
74
75
75
// For each pairs, both orders are considered.
76
- const METHODS_WITH_NEGATION : [ ( Option < RustcVersion > , & str , & str ) ; 3 ] = [
77
- ( None , " is_some" , " is_none" ) ,
78
- ( None , " is_err" , " is_ok" ) ,
79
- ( Some ( msrvs:: IS_NONE_OR ) , " is_some_and" , " is_none_or" ) ,
76
+ const METHODS_WITH_NEGATION : [ ( Option < RustcVersion > , Symbol , Symbol ) ; 3 ] = [
77
+ ( None , sym :: is_some, sym :: is_none) ,
78
+ ( None , sym :: is_err, sym :: is_ok) ,
79
+ ( Some ( msrvs:: IS_NONE_OR ) , sym :: is_some_and, sym :: is_none_or) ,
80
80
] ;
81
81
82
82
pub struct NonminimalBool {
@@ -440,9 +440,7 @@ fn simplify_not(cx: &LateContext<'_>, curr_msrv: Msrv, expr: &Expr<'_>) -> Optio
440
440
. iter ( )
441
441
. copied ( )
442
442
. flat_map ( |( msrv, a, b) | vec ! [ ( msrv, a, b) , ( msrv, b, a) ] )
443
- . find ( |& ( msrv, a, _) | {
444
- a == path. ident . name . as_str ( ) && msrv. is_none_or ( |msrv| curr_msrv. meets ( cx, msrv) )
445
- } )
443
+ . find ( |& ( msrv, a, _) | a == path. ident . name && msrv. is_none_or ( |msrv| curr_msrv. meets ( cx, msrv) ) )
446
444
. and_then ( |( _, _, neg_method) | {
447
445
let negated_args = args
448
446
. iter ( )
0 commit comments