We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 83874d0 commit a524be6Copy full SHA for a524be6
clippy_lints/src/booleans.rs
@@ -1,5 +1,5 @@
1
use crate::utils::{
2
- get_trait_def_id, is_type_diagnostic_item, implements_trait, in_macro, paths, snippet_opt, span_lint_and_sugg,
+ get_trait_def_id, implements_trait, in_macro, is_type_diagnostic_item, paths, snippet_opt, span_lint_and_sugg,
3
span_lint_and_then, SpanlessEq,
4
};
5
use if_chain::if_chain;
@@ -249,7 +249,9 @@ fn simplify_not(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> Option<String> {
249
},
250
ExprKind::MethodCall(path, _, args) if args.len() == 1 => {
251
let type_of_receiver = cx.tables.expr_ty(&args[0]);
252
- if !is_type_diagnostic_item(cx, type_of_receiver, sym!(option_type)) && !is_type_diagnostic_item(cx, type_of_receiver, sym!(result_type)) {
+ if !is_type_diagnostic_item(cx, type_of_receiver, sym!(option_type))
253
+ && !is_type_diagnostic_item(cx, type_of_receiver, sym!(result_type))
254
+ {
255
return None;
256
}
257
METHODS_WITH_NEGATION
clippy_lints/src/cognitive_complexity.rs
@@ -9,7 +9,7 @@ use rustc_session::{declare_tool_lint, impl_lint_pass};
9
use rustc_span::source_map::Span;
10
use rustc_span::BytePos;
11
12
-use crate::utils::{snippet_opt, span_lint_and_help, LimitStack, is_type_diagnostic_item};
+use crate::utils::{is_type_diagnostic_item, snippet_opt, span_lint_and_help, LimitStack};
13
14
declare_clippy_lint! {
15
/// **What it does:** Checks for methods with high cognitive complexity.
clippy_lints/src/fallible_impl_from.rs
@@ -1,5 +1,7 @@
use crate::utils::paths::{BEGIN_PANIC, BEGIN_PANIC_FMT, FROM_TRAIT};
-use crate::utils::{is_expn_of, match_def_path, method_chain_args, span_lint_and_then, walk_ptrs_ty, is_type_diagnostic_item};
+use crate::utils::{
+ is_expn_of, is_type_diagnostic_item, match_def_path, method_chain_args, span_lint_and_then, walk_ptrs_ty,
+};
6
use rustc_hir as hir;
7
use rustc_lint::{LateContext, LateLintPass};
@@ -76,7 +78,9 @@ fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_it
76
78
// check for `unwrap`
77
79
if let Some(arglists) = method_chain_args(expr, &["unwrap"]) {
80
let reciever_ty = walk_ptrs_ty(self.tables.expr_ty(&arglists[0][0]));
- if is_type_diagnostic_item(self.lcx, reciever_ty, sym!(option_type)) || is_type_diagnostic_item(self.lcx, reciever_ty, sym!(result_type)) {
81
+ if is_type_diagnostic_item(self.lcx, reciever_ty, sym!(option_type))
82
+ || is_type_diagnostic_item(self.lcx, reciever_ty, sym!(result_type))
83
84
self.result.push(expr.span);
85
86
clippy_lints/src/matches.rs
@@ -3,10 +3,10 @@ use crate::utils::paths;
use crate::utils::sugg::Sugg;
use crate::utils::usage::is_unused;
- expr_block, get_arg_name, get_parent_expr, in_macro, indent_of, is_allowed, is_expn_of, is_refutable, is_type_diagnostic_item, is_wild,
- match_qpath, match_type, match_var, multispan_sugg, remove_blocks, snippet, snippet_block,
8
- snippet_with_applicability, span_lint_and_help, span_lint_and_note, span_lint_and_sugg, span_lint_and_then,
- walk_ptrs_ty,
+ expr_block, get_arg_name, get_parent_expr, in_macro, indent_of, is_allowed, is_expn_of, is_refutable,
+ is_type_diagnostic_item, is_wild, match_qpath, match_type, match_var, multispan_sugg, remove_blocks, snippet,
+ snippet_block, snippet_with_applicability, span_lint_and_help, span_lint_and_note, span_lint_and_sugg,
+ span_lint_and_then, walk_ptrs_ty,
use rustc_ast::ast::LitKind;
clippy_lints/src/methods/mod.rs
@@ -3209,9 +3209,7 @@ fn is_maybe_uninit_ty_valid(cx: &LateContext<'_, '_>, ty: Ty<'_>) -> bool {
3209
match ty.kind {
3210
ty::Array(ref component, _) => is_maybe_uninit_ty_valid(cx, component),
3211
ty::Tuple(ref types) => types.types().all(|ty| is_maybe_uninit_ty_valid(cx, ty)),
3212
- ty::Adt(ref adt, _) => {
3213
- match_def_path(cx, adt.did, &paths::MEM_MAYBEUNINIT)
3214
- },
+ ty::Adt(ref adt, _) => match_def_path(cx, adt.did, &paths::MEM_MAYBEUNINIT),
3215
_ => false,
3216
3217
clippy_lints/src/question_mark.rs
@@ -7,7 +7,8 @@ use rustc_session::{declare_lint_pass, declare_tool_lint};
- higher, is_type_diagnostic_item, match_def_path, match_qpath, paths, snippet_with_applicability, span_lint_and_sugg, SpanlessEq,
+ higher, is_type_diagnostic_item, match_def_path, match_qpath, paths, snippet_with_applicability,
+ span_lint_and_sugg, SpanlessEq,
clippy_lints/src/unwrap.rs
@@ -1,4 +1,4 @@
-use crate::utils::{higher::if_block, span_lint_and_then, usage::is_potentially_mutated, is_type_diagnostic_item};
+use crate::utils::{higher::if_block, is_type_diagnostic_item, span_lint_and_then, usage::is_potentially_mutated};
use rustc_hir::intravisit::{walk_expr, walk_fn, FnKind, NestedVisitorMap, Visitor};
use rustc_hir::{BinOpKind, Body, Expr, ExprKind, FnDecl, HirId, Path, QPath, UnOp};
0 commit comments