Merge remote-tracking branch 'upstream/master' into rustup
This commit is contained in:
commit
415fdb2d1a
522 changed files with 5251 additions and 2556 deletions
|
|
@ -1,26 +1,20 @@
|
|||
use super::ARITHMETIC_SIDE_EFFECTS;
|
||||
use clippy_utils::is_from_proc_macro;
|
||||
use clippy_utils::{
|
||||
consts::{constant, constant_simple, Constant},
|
||||
diagnostics::span_lint,
|
||||
is_lint_allowed, peel_hir_expr_refs, peel_hir_expr_unary,
|
||||
};
|
||||
use rustc_ast as ast;
|
||||
use clippy_utils::consts::{constant, constant_simple, Constant};
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
use clippy_utils::{is_from_proc_macro, is_lint_allowed, peel_hir_expr_refs, peel_hir_expr_unary};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_hir as hir;
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_session::impl_lint_pass;
|
||||
use rustc_span::{
|
||||
source_map::{Span, Spanned},
|
||||
Symbol,
|
||||
};
|
||||
use rustc_span::source_map::{Span, Spanned};
|
||||
use rustc_span::Symbol;
|
||||
use {rustc_ast as ast, rustc_hir as hir};
|
||||
|
||||
const HARD_CODED_ALLOWED_BINARY: &[[&str; 2]] = &[
|
||||
["f32", "f32"],
|
||||
["f64", "f64"],
|
||||
["std::num::Saturating", "std::num::Saturating"],
|
||||
["std::num::Wrapping", "std::num::Wrapping"],
|
||||
["std::num::Saturating", "*"],
|
||||
["std::num::Wrapping", "*"],
|
||||
["std::string::String", "str"],
|
||||
];
|
||||
const HARD_CODED_ALLOWED_UNARY: &[&str] = &["f32", "f64", "std::num::Saturating", "std::num::Wrapping"];
|
||||
|
|
@ -200,7 +194,9 @@ impl ArithmeticSideEffects {
|
|||
ps: &hir::PathSegment<'tcx>,
|
||||
receiver: &hir::Expr<'tcx>,
|
||||
) {
|
||||
let Some(arg) = args.first() else { return; };
|
||||
let Some(arg) = args.first() else {
|
||||
return;
|
||||
};
|
||||
if constant_simple(cx, cx.typeck_results(), receiver).is_some() {
|
||||
return;
|
||||
}
|
||||
|
|
@ -225,7 +221,9 @@ impl ArithmeticSideEffects {
|
|||
un_expr: &hir::Expr<'tcx>,
|
||||
un_op: hir::UnOp,
|
||||
) {
|
||||
let hir::UnOp::Neg = un_op else { return; };
|
||||
let hir::UnOp::Neg = un_op else {
|
||||
return;
|
||||
};
|
||||
if constant(cx, cx.typeck_results(), un_expr).is_some() {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
use clippy_utils::binop_traits;
|
||||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use clippy_utils::source::snippet_opt;
|
||||
use clippy_utils::ty::implements_trait;
|
||||
use clippy_utils::visitors::for_each_expr;
|
||||
use clippy_utils::{eq_expr_value, trait_ref_of_method};
|
||||
use clippy_utils::{binop_traits, eq_expr_value, trait_ref_of_method};
|
||||
use core::ops::ControlFlow;
|
||||
use if_chain::if_chain;
|
||||
use rustc_errors::Applicability;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use clippy_utils::ast_utils::is_useless_with_eq_exprs;
|
||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_then};
|
||||
use clippy_utils::macros::{find_assert_eq_args, first_node_macro_backtrace};
|
||||
use clippy_utils::{ast_utils::is_useless_with_eq_exprs, eq_expr_value, is_in_test_function};
|
||||
use clippy_utils::{eq_expr_value, is_in_test_function};
|
||||
use rustc_hir::{BinOpKind, Expr};
|
||||
use rustc_lint::LateContext;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use clippy_utils::diagnostics::span_lint_and_then;
|
||||
use clippy_utils::eq_expr_value;
|
||||
use clippy_utils::source::snippet_opt;
|
||||
use clippy_utils::sugg;
|
||||
use clippy_utils::{eq_expr_value, sugg};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir as hir;
|
||||
use rustc_lint::LateContext;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ use clippy_utils::source::snippet;
|
|||
use clippy_utils::ty::{implements_trait, is_copy};
|
||||
use if_chain::if_chain;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{def::Res, def_id::DefId, BinOpKind, BorrowKind, Expr, ExprKind, GenericArg, ItemKind, QPath, TyKind};
|
||||
use rustc_hir::def::Res;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{BinOpKind, BorrowKind, Expr, ExprKind, GenericArg, ItemKind, QPath, TyKind};
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue