diff --git a/clippy_lints/src/format.rs b/clippy_lints/src/format.rs index 6053b9acfaf0..5b092526ce4f 100644 --- a/clippy_lints/src/format.rs +++ b/clippy_lints/src/format.rs @@ -1,7 +1,7 @@ use crate::utils::paths; use crate::utils::{ - is_expn_of, is_type_diagnostic_item, last_path_segment, match_def_path, match_function_call, snippet, span_lint_and_then, - walk_ptrs_ty, + is_expn_of, is_type_diagnostic_item, last_path_segment, match_def_path, match_function_call, snippet, + span_lint_and_then, walk_ptrs_ty, }; use if_chain::if_chain; use rustc_ast::ast::LitKind; diff --git a/clippy_lints/src/inherent_to_string.rs b/clippy_lints/src/inherent_to_string.rs index 5a577460c424..289628a2752a 100644 --- a/clippy_lints/src/inherent_to_string.rs +++ b/clippy_lints/src/inherent_to_string.rs @@ -4,8 +4,8 @@ use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use crate::utils::{ - get_trait_def_id, is_type_diagnostic_item, implements_trait, paths, return_ty, span_lint_and_help, trait_ref_of_method, - walk_ptrs_ty, + get_trait_def_id, implements_trait, is_type_diagnostic_item, paths, return_ty, span_lint_and_help, + trait_ref_of_method, walk_ptrs_ty, }; declare_clippy_lint! { diff --git a/clippy_lints/src/methods/inefficient_to_string.rs b/clippy_lints/src/methods/inefficient_to_string.rs index 48eda0edca3f..06138ab9783c 100644 --- a/clippy_lints/src/methods/inefficient_to_string.rs +++ b/clippy_lints/src/methods/inefficient_to_string.rs @@ -1,5 +1,7 @@ use super::INEFFICIENT_TO_STRING; -use crate::utils::{match_def_path, is_type_diagnostic_item, paths, snippet_with_applicability, span_lint_and_then, walk_ptrs_ty_depth}; +use crate::utils::{ + is_type_diagnostic_item, match_def_path, paths, snippet_with_applicability, span_lint_and_then, walk_ptrs_ty_depth, +}; use if_chain::if_chain; use rustc_errors::Applicability; use rustc_hir as hir; @@ -45,16 +47,15 @@ pub fn lint<'tcx>(cx: &LateContext<'_, 'tcx>, expr: &hir::Expr<'_>, arg: &hir::E /// Currently, these are `str`, `String`, and `Cow<'_, str>`. fn specializes_tostring(cx: &LateContext<'_, '_>, ty: Ty<'_>) -> bool { if let ty::Str = ty.kind { - return true + return true; } if is_type_diagnostic_item(cx, ty, sym!(string_type)) { - return true + return true; } if let ty::Adt(adt, substs) = ty.kind { - match_def_path(cx, adt.did, &paths::COW) && - substs.type_at(1).is_str() + match_def_path(cx, adt.did, &paths::COW) && substs.type_at(1).is_str() } else { false } diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs index 3d52f87ff937..9f97f3561b71 100644 --- a/clippy_lints/src/needless_pass_by_value.rs +++ b/clippy_lints/src/needless_pass_by_value.rs @@ -1,7 +1,7 @@ use crate::utils::ptr::get_spans; use crate::utils::{ - get_trait_def_id, implements_trait, is_copy, is_self, is_type_diagnostic_item, multispan_sugg, paths, - snippet, snippet_opt, span_lint_and_then, + get_trait_def_id, implements_trait, is_copy, is_self, is_type_diagnostic_item, multispan_sugg, paths, snippet, + snippet_opt, span_lint_and_then, }; use if_chain::if_chain; use rustc_ast::ast::Attribute; diff --git a/clippy_lints/src/redundant_clone.rs b/clippy_lints/src/redundant_clone.rs index 3ddaefd2673c..d5cace0c6474 100644 --- a/clippy_lints/src/redundant_clone.rs +++ b/clippy_lints/src/redundant_clone.rs @@ -1,6 +1,6 @@ use crate::utils::{ - fn_has_unsatisfiable_preds, has_drop, is_copy, is_type_diagnostic_item, match_def_path, match_type, paths, snippet_opt, span_lint_hir, - span_lint_hir_and_then, walk_ptrs_ty_depth, + fn_has_unsatisfiable_preds, has_drop, is_copy, is_type_diagnostic_item, match_def_path, match_type, paths, + snippet_opt, span_lint_hir, span_lint_hir_and_then, walk_ptrs_ty_depth, }; use if_chain::if_chain; use rustc_data_structures::{fx::FxHashMap, transitive_relation::TransitiveRelation}; @@ -113,7 +113,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone { let from_borrow = match_def_path(cx, fn_def_id, &paths::CLONE_TRAIT_METHOD) || match_def_path(cx, fn_def_id, &paths::TO_OWNED_METHOD) - || (match_def_path(cx, fn_def_id, &paths::TO_STRING_METHOD) && is_type_diagnostic_item(cx, arg_ty, sym!(string_type))); + || (match_def_path(cx, fn_def_id, &paths::TO_STRING_METHOD) + && is_type_diagnostic_item(cx, arg_ty, sym!(string_type))); let from_deref = !from_borrow && (match_def_path(cx, fn_def_id, &paths::PATH_TO_PATH_BUF) diff --git a/clippy_lints/src/swap.rs b/clippy_lints/src/swap.rs index 7bbebca8ab3b..c52e6a643f2a 100644 --- a/clippy_lints/src/swap.rs +++ b/clippy_lints/src/swap.rs @@ -1,7 +1,7 @@ use crate::utils::sugg::Sugg; use crate::utils::{ - differing_macro_contexts, is_type_diagnostic_item, snippet_with_applicability, - span_lint_and_then, walk_ptrs_ty, SpanlessEq, + differing_macro_contexts, is_type_diagnostic_item, snippet_with_applicability, span_lint_and_then, walk_ptrs_ty, + SpanlessEq, }; use if_chain::if_chain; use rustc_errors::Applicability; diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index c64e77c6f440..d8d6dcc3777e 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -29,10 +29,10 @@ use rustc_typeck::hir_ty_to_ty; use crate::consts::{constant, Constant}; use crate::utils::paths; use crate::utils::{ - clip, comparisons, differing_macro_contexts, higher, in_constant, int_bits, is_type_diagnostic_item, last_path_segment, match_def_path, - match_path, method_chain_args, multispan_sugg, numeric_literal::NumericLiteral, qpath_res, same_tys, sext, snippet, - snippet_opt, snippet_with_applicability, snippet_with_macro_callsite, span_lint, span_lint_and_help, - span_lint_and_sugg, span_lint_and_then, unsext, + clip, comparisons, differing_macro_contexts, higher, in_constant, int_bits, is_type_diagnostic_item, + last_path_segment, match_def_path, match_path, method_chain_args, multispan_sugg, numeric_literal::NumericLiteral, + qpath_res, same_tys, sext, snippet, snippet_opt, snippet_with_applicability, snippet_with_macro_callsite, + span_lint, span_lint_and_help, span_lint_and_sugg, span_lint_and_then, unsext, }; declare_clippy_lint! {