diff --git a/detectors/avoid-autokey-upgradable/src/lib.rs b/detectors/avoid-autokey-upgradable/src/lib.rs index 7dbc2eab..42fb777c 100644 --- a/detectors/avoid-autokey-upgradable/src/lib.rs +++ b/detectors/avoid-autokey-upgradable/src/lib.rs @@ -5,6 +5,7 @@ extern crate rustc_error_messages; extern crate rustc_hir; extern crate rustc_span; +use clippy_wrappers::span_lint_and_note; use itertools::Itertools; use rustc_error_messages::MultiSpan; use rustc_hir::GenericArg; @@ -14,7 +15,6 @@ use rustc_hir::{ }; use rustc_lint::{LateContext, LateLintPass}; use rustc_span::Span; -use clippy_wrappers::span_lint_and_note; scout_audit_dylint_linting::impl_late_lint! { pub AVOID_AUTOKEY_UPGRADABLE, diff --git a/detectors/avoid-format-string/src/lib.rs b/detectors/avoid-format-string/src/lib.rs index 4f82d2d5..d6e837a0 100644 --- a/detectors/avoid-format-string/src/lib.rs +++ b/detectors/avoid-format-string/src/lib.rs @@ -4,6 +4,7 @@ extern crate rustc_ast; extern crate rustc_span; +use clippy_utils::sym; use if_chain::if_chain; use rustc_ast::{ tokenstream::{TokenStream, TokenTree}, @@ -11,7 +12,6 @@ use rustc_ast::{ }; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_span::{sym, Span}; -use clippy_utils::sym; const LINT_MESSAGE: &str = "The format! macro should not be used."; diff --git a/detectors/avoid-unsafe-block/src/lib.rs b/detectors/avoid-unsafe-block/src/lib.rs index ff15ff2d..dc7abc34 100644 --- a/detectors/avoid-unsafe-block/src/lib.rs +++ b/detectors/avoid-unsafe-block/src/lib.rs @@ -3,9 +3,9 @@ extern crate rustc_ast; extern crate rustc_span; +use clippy_wrappers::span_lint; use rustc_ast::{BlockCheckMode, Expr, ExprKind, UnsafeSource}; use rustc_lint::{EarlyContext, EarlyLintPass}; -use clippy_wrappers::span_lint; const LINT_MESSAGE: &str = "Avoid using unsafe blocks as it may lead to undefined behavior."; scout_audit_dylint_linting::impl_pre_expansion_lint! { diff --git a/detectors/buffering-unsized-types/src/lib.rs b/detectors/buffering-unsized-types/src/lib.rs index 6cb89b4f..1a0009ad 100644 --- a/detectors/buffering-unsized-types/src/lib.rs +++ b/detectors/buffering-unsized-types/src/lib.rs @@ -5,6 +5,7 @@ extern crate rustc_hir; extern crate rustc_span; use std::collections::HashMap; +use clippy_wrappers::span_lint_and_help; use rustc_hir::{ intravisit::{walk_expr, Visitor}, Expr, ExprKind, GenericArg, QPath, Ty, TyKind, @@ -12,7 +13,6 @@ use rustc_hir::{ use rustc_lint::{LateContext, LateLintPass}; use rustc_span::symbol::Ident; use rustc_span::Span; -use clippy_wrappers::span_lint_and_help; const LINT_MESSAGE: &str = "Do not use these method with an unsized (dynamically sized) type."; scout_audit_dylint_linting::impl_late_lint! { pub BUFFERING_UNSIZED_TYPES, diff --git a/detectors/dos-unexpected-revert-with-vector/src/lib.rs b/detectors/dos-unexpected-revert-with-vector/src/lib.rs index 6e1280cf..31ffc64d 100644 --- a/detectors/dos-unexpected-revert-with-vector/src/lib.rs +++ b/detectors/dos-unexpected-revert-with-vector/src/lib.rs @@ -216,12 +216,7 @@ impl<'tcx> LateLintPass<'tcx> for UnexpectedRevertWarn { &mut HashSet::::default(), ); for place in unchecked_places { - clippy_wrappers::span_lint( - cx, - UNEXPECTED_REVERT_WARN, - place.1, - LINT_MESSAGE, - ); + clippy_wrappers::span_lint(cx, UNEXPECTED_REVERT_WARN, place.1, LINT_MESSAGE); } } diff --git a/detectors/incorrect-exponentiation/src/lib.rs b/detectors/incorrect-exponentiation/src/lib.rs index 35b2433d..a594552e 100644 --- a/detectors/incorrect-exponentiation/src/lib.rs +++ b/detectors/incorrect-exponentiation/src/lib.rs @@ -4,6 +4,7 @@ extern crate rustc_hir; extern crate rustc_span; +use clippy_wrappers::span_lint_and_help; use rustc_hir::def_id::LocalDefId; use rustc_hir::intravisit::Visitor; use rustc_hir::intravisit::{walk_expr, FnKind}; @@ -11,7 +12,6 @@ use rustc_hir::{Body, FnDecl}; use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_span::Span; -use clippy_wrappers::span_lint_and_help; const LINT_MESSAGE: &str = "'^' It is not an exponential operator. It is a bitwise XOR."; const LINT_HELP: &str = "If you want to use XOR, use bitxor(). If you want to raise a number use .checked_pow() or .pow() "; diff --git a/detectors/integer-overflow-or-underflow/src/lib.rs b/detectors/integer-overflow-or-underflow/src/lib.rs index 8ac7048b..dc9ca643 100644 --- a/detectors/integer-overflow-or-underflow/src/lib.rs +++ b/detectors/integer-overflow-or-underflow/src/lib.rs @@ -3,12 +3,12 @@ extern crate rustc_hir; extern crate rustc_span; +use clippy_utils::consts::constant_simple; +use clippy_utils::is_integer_literal; use rustc_hir::{self as hir, Body, Expr, ExprKind, UnOp}; use rustc_lint::LateContext; use rustc_lint::LateLintPass; use rustc_span::Span; -use clippy_utils::consts::constant_simple; -use clippy_utils::is_integer_literal; pub const LINT_MESSAGE: &str = "Potential for integer arithmetic overflow/underflow. Consider checked, wrapping or saturating arithmetic."; diff --git a/detectors/lazy-values-not-set/src/lib.rs b/detectors/lazy-values-not-set/src/lib.rs index 86363304..5270a56a 100644 --- a/detectors/lazy-values-not-set/src/lib.rs +++ b/detectors/lazy-values-not-set/src/lib.rs @@ -8,6 +8,7 @@ extern crate rustc_span; use std::collections::HashMap; +use clippy_utils::match_def_path; use rustc_hir::def_id::DefId; use rustc_hir::intravisit::{walk_expr, FnKind, Visitor}; use rustc_hir::{Body, FnDecl}; @@ -17,7 +18,6 @@ use rustc_middle::mir::{Local, Operand, Rvalue, TerminatorKind}; use rustc_middle::ty::TyKind; use rustc_span::def_id::LocalDefId; use rustc_span::Span; -use clippy_utils::match_def_path; const LINT_MESSAGE: &str = "Lazy value was gotten here but never set afterwards"; @@ -120,12 +120,7 @@ impl<'tcx> LateLintPass<'tcx> for LazyValuesNotSet { let (_, hm) = self.get_func_info(cx, id.to_def_id(), &[], &[], &mut vec![]); for val in hm.values() { - clippy_wrappers::span_lint( - cx, - LAZY_VALUES_NOT_SET, - *val, - LINT_MESSAGE, - ); + clippy_wrappers::span_lint(cx, LAZY_VALUES_NOT_SET, *val, LINT_MESSAGE); } } } diff --git a/detectors/non-payable-transferred-value/src/lib.rs b/detectors/non-payable-transferred-value/src/lib.rs index 8e193bf4..69d1cb51 100644 --- a/detectors/non-payable-transferred-value/src/lib.rs +++ b/detectors/non-payable-transferred-value/src/lib.rs @@ -3,6 +3,7 @@ #![feature(let_chains)] extern crate rustc_ast; extern crate rustc_span; +use clippy_wrappers::span_lint_and_help; use rustc_ast::{ tokenstream::{TokenStream, TokenTree}, visit::{walk_block, walk_expr, Visitor}, @@ -10,7 +11,6 @@ use rustc_ast::{ }; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_span::Span; -use clippy_wrappers::span_lint_and_help; const LINT_MESSAGE: &str = "Using `transferred_value` without #[ink(payable)] will always return 0."; diff --git a/detectors/panic-error/src/lib.rs b/detectors/panic-error/src/lib.rs index 4fefcd4f..8fb63034 100644 --- a/detectors/panic-error/src/lib.rs +++ b/detectors/panic-error/src/lib.rs @@ -4,6 +4,7 @@ extern crate rustc_ast; extern crate rustc_span; +use clippy_utils::sym; use if_chain::if_chain; use rustc_ast::{ ptr::P, @@ -13,7 +14,6 @@ use rustc_ast::{ }; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_span::{sym, Span}; -use clippy_utils::sym; const LINT_MESSAGE: &str = "The panic! macro is used to stop execution when a condition is not met. This is useful for testing and prototyping, but should be avoided in production code"; diff --git a/detectors/unsafe-expect/src/lib.rs b/detectors/unsafe-expect/src/lib.rs index 879190ed..07558c9b 100644 --- a/detectors/unsafe-expect/src/lib.rs +++ b/detectors/unsafe-expect/src/lib.rs @@ -6,6 +6,8 @@ extern crate rustc_span; use std::{collections::HashSet, hash::Hash}; +use clippy_utils::higher; +use clippy_wrappers::span_lint_and_help; use if_chain::if_chain; use rustc_hir::{ def::Res, @@ -15,8 +17,6 @@ use rustc_hir::{ }; use rustc_lint::{LateContext, LateLintPass}; use rustc_span::{sym, Span, Symbol}; -use clippy_utils::higher; -use clippy_wrappers::span_lint_and_help; const LINT_MESSAGE: &str = "Unsafe usage of `expect`"; const PANIC_INDUCING_FUNCTIONS: [&str; 2] = ["panic", "bail"]; diff --git a/detectors/unsafe-unwrap/src/lib.rs b/detectors/unsafe-unwrap/src/lib.rs index 55039863..f4727a14 100644 --- a/detectors/unsafe-unwrap/src/lib.rs +++ b/detectors/unsafe-unwrap/src/lib.rs @@ -6,6 +6,8 @@ extern crate rustc_span; use std::{collections::HashSet, hash::Hash}; +use clippy_utils::higher; +use clippy_wrappers::span_lint_and_help; use if_chain::if_chain; use rustc_hir::{ def::Res, @@ -15,8 +17,6 @@ use rustc_hir::{ }; use rustc_lint::{LateContext, LateLintPass}; use rustc_span::{sym, Span, Symbol}; -use clippy_utils::higher; -use clippy_wrappers::span_lint_and_help; const LINT_MESSAGE: &str = "Unsafe usage of `unwrap`"; const PANIC_INDUCING_FUNCTIONS: [&str; 2] = ["panic", "bail"]; diff --git a/detectors/vec-could-be-mapping/src/lib.rs b/detectors/vec-could-be-mapping/src/lib.rs index a3fd001a..ef326ef0 100644 --- a/detectors/vec-could-be-mapping/src/lib.rs +++ b/detectors/vec-could-be-mapping/src/lib.rs @@ -8,6 +8,7 @@ extern crate rustc_span; use std::collections::HashMap; +use clippy_wrappers::span_lint_and_help; use itertools::Itertools; use rustc_hir::intravisit::{walk_expr, FnKind, Visitor}; use rustc_hir::{Body, Expr, ExprKind, FnDecl, GenericArg, GenericArgs, PathSegment, QPath}; @@ -15,7 +16,6 @@ use rustc_hir::{Ty, TyKind}; use rustc_lint::{LateContext, LateLintPass}; use rustc_span::def_id::LocalDefId; use rustc_span::Span; -use clippy_wrappers::span_lint_and_help; const LINT_MESSAGE: &str = "You are iterating over a vector of tuples using `find`. Consider using a mapping instead."; diff --git a/detectors/warning-sr25519-verify/src/lib.rs b/detectors/warning-sr25519-verify/src/lib.rs index 55140ce4..042f4c0e 100644 --- a/detectors/warning-sr25519-verify/src/lib.rs +++ b/detectors/warning-sr25519-verify/src/lib.rs @@ -4,13 +4,13 @@ extern crate rustc_ast; extern crate rustc_hir; extern crate rustc_span; +use clippy_wrappers::span_lint_and_help; use rustc_hir::{ intravisit::{walk_body, walk_expr, Visitor}, Expr, ExprKind, QPath, }; use rustc_lint::LateLintPass; use rustc_span::Span; -use clippy_wrappers::span_lint_and_help; const LINT_MESSAGE: &str = "This function is from the unstable interface, which is unsafe and normally is not available on production chains.";