Skip to content

Commit 70c0f90

Browse files
committed
Auto merge of #6718 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 8dbcffe + 4efc454 commit 70c0f90

39 files changed

+84
-95
lines changed

Diff for: Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.51"
3+
version = "0.1.52"
44
authors = [
55
"Manish Goregaokar <[email protected]>",
66
"Andre Bogus <[email protected]>",

Diff for: clippy_lints/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "clippy_lints"
33
# begin automatic update
4-
version = "0.1.51"
4+
version = "0.1.52"
55
# end automatic update
66
authors = [
77
"Manish Goregaokar <[email protected]>",

Diff for: clippy_lints/src/arithmetic.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl<'tcx> LateLintPass<'tcx> for Arithmetic {
9191
match op.node {
9292
hir::BinOpKind::Div | hir::BinOpKind::Rem => match &r.kind {
9393
hir::ExprKind::Lit(_lit) => (),
94-
hir::ExprKind::Unary(hir::UnOp::UnNeg, expr) => {
94+
hir::ExprKind::Unary(hir::UnOp::Neg, expr) => {
9595
if let hir::ExprKind::Lit(lit) = &expr.kind {
9696
if let rustc_ast::ast::LitKind::Int(1, _) = lit.node {
9797
span_lint(cx, INTEGER_ARITHMETIC, expr.span, "integer arithmetic detected");
@@ -114,7 +114,7 @@ impl<'tcx> LateLintPass<'tcx> for Arithmetic {
114114
self.expr_span = Some(expr.span);
115115
}
116116
},
117-
hir::ExprKind::Unary(hir::UnOp::UnNeg, arg) => {
117+
hir::ExprKind::Unary(hir::UnOp::Neg, arg) => {
118118
let ty = cx.typeck_results().expr_ty(arg);
119119
if constant_simple(cx, cx.typeck_results(), expr).is_none() {
120120
if ty.is_integral() {

Diff for: clippy_lints/src/assertions_on_constants.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ enum AssertKind {
112112
fn match_assert_with_message<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> Option<AssertKind> {
113113
if_chain! {
114114
if let ExprKind::If(ref cond, ref then, _) = expr.kind;
115-
if let ExprKind::Unary(UnOp::UnNot, ref expr) = cond.kind;
115+
if let ExprKind::Unary(UnOp::Not, ref expr) = cond.kind;
116116
// bind the first argument of the `assert!` macro
117117
if let Some((Constant::Bool(is_true), _)) = constant(cx, cx.typeck_results(), expr);
118118
// block

Diff for: clippy_lints/src/booleans.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> {
110110
// prevent folding of `cfg!` macros and the like
111111
if !e.span.from_expansion() {
112112
match &e.kind {
113-
ExprKind::Unary(UnOp::UnNot, inner) => return Ok(Bool::Not(box self.run(inner)?)),
113+
ExprKind::Unary(UnOp::Not, inner) => return Ok(Bool::Not(box self.run(inner)?)),
114114
ExprKind::Binary(binop, lhs, rhs) => match &binop.node {
115115
BinOpKind::Or => {
116116
return Ok(Bool::Or(self.extract(BinOpKind::Or, &[lhs, rhs], Vec::new())?));
@@ -454,7 +454,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NonminimalBoolVisitor<'a, 'tcx> {
454454
ExprKind::Binary(binop, _, _) if binop.node == BinOpKind::Or || binop.node == BinOpKind::And => {
455455
self.bool_expr(e)
456456
},
457-
ExprKind::Unary(UnOp::UnNot, inner) => {
457+
ExprKind::Unary(UnOp::Not, inner) => {
458458
if self.cx.typeck_results().node_types()[inner.hir_id].is_bool() {
459459
self.bool_expr(e);
460460
} else {
@@ -482,7 +482,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NotSimplificationVisitor<'a, 'tcx> {
482482
type Map = Map<'tcx>;
483483

484484
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
485-
if let ExprKind::Unary(UnOp::UnNot, inner) = &expr.kind {
485+
if let ExprKind::Unary(UnOp::Not, inner) = &expr.kind {
486486
if let Some(suggestion) = simplify_not(self.cx, inner) {
487487
span_lint_and_sugg(
488488
self.cx,

Diff for: clippy_lints/src/bytecount.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ fn check_arg(name: Symbol, arg: Symbol, needle: &Expr<'_>) -> bool {
101101

102102
fn get_path_name(expr: &Expr<'_>) -> Option<Symbol> {
103103
match expr.kind {
104-
ExprKind::Box(ref e) | ExprKind::AddrOf(BorrowKind::Ref, _, ref e) | ExprKind::Unary(UnOp::UnDeref, ref e) => {
104+
ExprKind::Box(ref e) | ExprKind::AddrOf(BorrowKind::Ref, _, ref e) | ExprKind::Unary(UnOp::Deref, ref e) => {
105105
get_path_name(e)
106106
},
107107
ExprKind::Block(ref b, _) => {

Diff for: clippy_lints/src/collapsible_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ fn strip_ref_operators<'hir>(mut expr: &'hir Expr<'hir>, typeck_results: &Typeck
180180
loop {
181181
match expr.kind {
182182
ExprKind::AddrOf(_, _, e) => expr = e,
183-
ExprKind::Unary(UnOp::UnDeref, e) if typeck_results.expr_ty(e).is_ref() => expr = e,
183+
ExprKind::Unary(UnOp::Deref, e) if typeck_results.expr_ty(e).is_ref() => expr = e,
184184
_ => break,
185185
}
186186
}

Diff for: clippy_lints/src/consts.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
242242
self.expr(value).map(|v| Constant::Repeat(Box::new(v), n))
243243
},
244244
ExprKind::Unary(op, ref operand) => self.expr(operand).and_then(|o| match op {
245-
UnOp::UnNot => self.constant_not(&o, self.typeck_results.expr_ty(e)),
246-
UnOp::UnNeg => self.constant_negate(&o, self.typeck_results.expr_ty(e)),
247-
UnOp::UnDeref => Some(if let Constant::Ref(r) = o { *r } else { o }),
245+
UnOp::Not => self.constant_not(&o, self.typeck_results.expr_ty(e)),
246+
UnOp::Neg => self.constant_negate(&o, self.typeck_results.expr_ty(e)),
247+
UnOp::Deref => Some(if let Constant::Ref(r) = o { *r } else { o }),
248248
}),
249249
ExprKind::If(ref cond, ref then, ref otherwise) => self.ifthenelse(cond, then, *otherwise),
250250
ExprKind::Binary(op, ref left, ref right) => self.binop(op, left, right),

Diff for: clippy_lints/src/entry.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ declare_lint_pass!(HashMapPass => [MAP_ENTRY]);
5555
impl<'tcx> LateLintPass<'tcx> for HashMapPass {
5656
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
5757
if let ExprKind::If(ref check, ref then_block, ref else_block) = expr.kind {
58-
if let ExprKind::Unary(UnOp::UnNot, ref check) = check.kind {
58+
if let ExprKind::Unary(UnOp::Not, ref check) = check.kind {
5959
if let Some((ty, map, key)) = check_cond(cx, check) {
6060
// in case of `if !m.contains_key(&k) { m.insert(k, v); }`
6161
// we can give a better error message

Diff for: clippy_lints/src/floating_point_arithmetic.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ fn get_specialized_log_method(cx: &LateContext<'_>, base: &Expr<'_>) -> Option<&
129129
fn prepare_receiver_sugg<'a>(cx: &LateContext<'_>, mut expr: &'a Expr<'a>) -> Sugg<'a> {
130130
let mut suggestion = Sugg::hir(cx, expr, "..");
131131

132-
if let ExprKind::Unary(UnOp::UnNeg, inner_expr) = &expr.kind {
132+
if let ExprKind::Unary(UnOp::Neg, inner_expr) = &expr.kind {
133133
expr = &inner_expr;
134134
}
135135

@@ -541,12 +541,12 @@ fn is_zero(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
541541
/// If the two expressions are not negations of each other, then it
542542
/// returns None.
543543
fn are_negated<'a>(cx: &LateContext<'_>, expr1: &'a Expr<'a>, expr2: &'a Expr<'a>) -> Option<(bool, &'a Expr<'a>)> {
544-
if let ExprKind::Unary(UnOp::UnNeg, expr1_negated) = &expr1.kind {
544+
if let ExprKind::Unary(UnOp::Neg, expr1_negated) = &expr1.kind {
545545
if eq_expr_value(cx, expr1_negated, expr2) {
546546
return Some((false, expr2));
547547
}
548548
}
549-
if let ExprKind::Unary(UnOp::UnNeg, expr2_negated) = &expr2.kind {
549+
if let ExprKind::Unary(UnOp::Neg, expr2_negated) = &expr2.kind {
550550
if eq_expr_value(cx, expr1, expr2_negated) {
551551
return Some((true, expr1));
552552
}

Diff for: clippy_lints/src/functions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for DerefVisitor<'a, 'tcx> {
644644
}
645645
}
646646
},
647-
hir::ExprKind::Unary(hir::UnOp::UnDeref, ref ptr) => self.check_arg(ptr),
647+
hir::ExprKind::Unary(hir::UnOp::Deref, ref ptr) => self.check_arg(ptr),
648648
_ => (),
649649
}
650650

Diff for: clippy_lints/src/map_clone.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl<'tcx> LateLintPass<'tcx> for MapClone {
7070
},
7171
hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, .., name, None) => {
7272
match closure_expr.kind {
73-
hir::ExprKind::Unary(hir::UnOp::UnDeref, ref inner) => {
73+
hir::ExprKind::Unary(hir::UnOp::Deref, ref inner) => {
7474
if ident_eq(name, inner) {
7575
if let ty::Ref(.., Mutability::Not) = cx.typeck_results().expr_ty(inner).kind() {
7676
lint(cx, e.span, args[0].span, true);

Diff for: clippy_lints/src/methods/manual_saturating_arithmetic.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ fn is_min_or_max<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>) -> Option<M
148148
}
149149

150150
if ty.is_signed() {
151-
if let hir::ExprKind::Unary(hir::UnOp::UnNeg, val) = &expr.kind {
151+
if let hir::ExprKind::Unary(hir::UnOp::Neg, val) = &expr.kind {
152152
return check_lit(val, true);
153153
}
154154
}
@@ -163,7 +163,7 @@ enum Sign {
163163
}
164164

165165
fn lit_sign(expr: &hir::Expr<'_>) -> Option<Sign> {
166-
if let hir::ExprKind::Unary(hir::UnOp::UnNeg, inner) = &expr.kind {
166+
if let hir::ExprKind::Unary(hir::UnOp::Neg, inner) = &expr.kind {
167167
if let hir::ExprKind::Lit(..) = &inner.kind {
168168
return Some(Sign::Neg);
169169
}

Diff for: clippy_lints/src/methods/mod.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -2235,7 +2235,10 @@ fn lint_expect_fun_call(
22352235
span_replace_word,
22362236
&format!("use of `{}` followed by a function call", name),
22372237
"try this",
2238-
format!("unwrap_or_else({} {{ panic!({}) }})", closure_args, arg_root_snippet),
2238+
format!(
2239+
"unwrap_or_else({} {{ panic!(\"{{}}\", {}) }})",
2240+
closure_args, arg_root_snippet
2241+
),
22392242
applicability,
22402243
);
22412244
}
@@ -2672,7 +2675,7 @@ fn lint_get_unwrap<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, get_args:
26722675
if_chain! {
26732676
if needs_ref;
26742677
if let Some(parent) = get_parent_expr(cx, expr);
2675-
if let hir::ExprKind::Unary(hir::UnOp::UnDeref, _) = parent.kind;
2678+
if let hir::ExprKind::Unary(hir::UnOp::Deref, _) = parent.kind;
26762679
then {
26772680
needs_ref = false;
26782681
span = parent.span;
@@ -3116,7 +3119,7 @@ fn lint_filter_map<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, is_f
31163119
// in `filter(|x| ..)`, replace `*x` with `x`
31173120
let a_path = if_chain! {
31183121
if !is_filter_param_ref;
3119-
if let ExprKind::Unary(UnOp::UnDeref, expr_path) = a.kind;
3122+
if let ExprKind::Unary(UnOp::Deref, expr_path) = a.kind;
31203123
then { expr_path } else { a }
31213124
};
31223125
// let the filter closure arg and the map closure arg be equal
@@ -3758,8 +3761,8 @@ fn lint_option_as_ref_deref<'tcx>(
37583761
},
37593762
hir::ExprKind::AddrOf(hir::BorrowKind::Ref, m, ref inner) if same_mutability(m) => {
37603763
if_chain! {
3761-
if let hir::ExprKind::Unary(hir::UnOp::UnDeref, ref inner1) = inner.kind;
3762-
if let hir::ExprKind::Unary(hir::UnOp::UnDeref, ref inner2) = inner1.kind;
3764+
if let hir::ExprKind::Unary(hir::UnOp::Deref, ref inner1) = inner.kind;
3765+
if let hir::ExprKind::Unary(hir::UnOp::Deref, ref inner2) = inner1.kind;
37633766
then {
37643767
path_to_local_id(inner2, closure_body.params[0].pat.hir_id)
37653768
} else {
@@ -4113,7 +4116,7 @@ fn lint_filetype_is_file(cx: &LateContext<'_>, expr: &hir::Expr<'_>, args: &[hir
41134116
if_chain! {
41144117
if let Some(parent) = get_parent_expr(cx, expr);
41154118
if let hir::ExprKind::Unary(op, _) = parent.kind;
4116-
if op == hir::UnOp::UnNot;
4119+
if op == hir::UnOp::Not;
41174120
then {
41184121
lint_unary = "!";
41194122
verb = "denies";

Diff for: clippy_lints/src/misc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ fn is_allowed<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> bool {
502502
// Return true if `expr` is the result of `signum()` invoked on a float value.
503503
fn is_signum(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
504504
// The negation of a signum is still a signum
505-
if let ExprKind::Unary(UnOp::UnNeg, ref child_expr) = expr.kind {
505+
if let ExprKind::Unary(UnOp::Neg, ref child_expr) = expr.kind {
506506
return is_signum(cx, &child_expr);
507507
}
508508

@@ -586,7 +586,7 @@ fn check_to_owned(cx: &LateContext<'_>, expr: &Expr<'_>, other: &Expr<'_>, left:
586586
return;
587587
}
588588

589-
let other_gets_derefed = matches!(other.kind, ExprKind::Unary(UnOp::UnDeref, _));
589+
let other_gets_derefed = matches!(other.kind, ExprKind::Unary(UnOp::Deref, _));
590590

591591
let lint_span = if other_gets_derefed {
592592
expr.span.to(other.span)

Diff for: clippy_lints/src/misc_early.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
use crate::utils::{constants, snippet_opt, span_lint, span_lint_and_help, span_lint_and_sugg, span_lint_and_then};
1+
use crate::utils::{snippet_opt, span_lint, span_lint_and_help, span_lint_and_sugg, span_lint_and_then};
22
use rustc_ast::ast::{
33
BindingMode, Expr, ExprKind, GenericParamKind, Generics, Lit, LitFloatType, LitIntType, LitKind, Mutability,
44
NodeId, Pat, PatKind, UnOp,
55
};
66
use rustc_ast::visit::FnKind;
77
use rustc_data_structures::fx::FxHashMap;
88
use rustc_errors::Applicability;
9+
use rustc_hir::PrimTy;
910
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
1011
use rustc_middle::lint::in_external_macro;
1112
use rustc_session::{declare_lint_pass, declare_tool_lint};
@@ -264,13 +265,12 @@ impl EarlyLintPass for MiscEarlyLints {
264265
fn check_generics(&mut self, cx: &EarlyContext<'_>, gen: &Generics) {
265266
for param in &gen.params {
266267
if let GenericParamKind::Type { .. } = param.kind {
267-
let name = param.ident.as_str();
268-
if constants::BUILTIN_TYPES.contains(&&*name) {
268+
if let Some(prim_ty) = PrimTy::from_name(param.ident.name) {
269269
span_lint(
270270
cx,
271271
BUILTIN_TYPE_SHADOW,
272272
param.ident.span,
273-
&format!("this generic shadows the built-in type `{}`", name),
273+
&format!("this generic shadows the built-in type `{}`", prim_ty.name()),
274274
);
275275
}
276276
}

Diff for: clippy_lints/src/needless_bool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ struct ExpressionInfoWithSpan {
195195
}
196196

197197
fn is_unary_not(e: &Expr<'_>) -> (bool, Span) {
198-
if let ExprKind::Unary(UnOp::UnNot, operand) = e.kind {
198+
if let ExprKind::Unary(UnOp::Not, operand) = e.kind {
199199
return (true, operand.span);
200200
}
201201
(false, e.span)

Diff for: clippy_lints/src/neg_cmp_op_on_partial_ord.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl<'tcx> LateLintPass<'tcx> for NoNegCompOpForPartialOrd {
5050
if_chain! {
5151

5252
if !in_external_macro(cx.sess(), expr.span);
53-
if let ExprKind::Unary(UnOp::UnNot, ref inner) = expr.kind;
53+
if let ExprKind::Unary(UnOp::Not, ref inner) = expr.kind;
5454
if let ExprKind::Binary(ref op, ref left, _) = inner.kind;
5555
if let BinOpKind::Le | BinOpKind::Ge | BinOpKind::Lt | BinOpKind::Gt = op.node;
5656

Diff for: clippy_lints/src/neg_multiply.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ impl<'tcx> LateLintPass<'tcx> for NegMultiply {
3232
if BinOpKind::Mul == op.node {
3333
match (&left.kind, &right.kind) {
3434
(&ExprKind::Unary(..), &ExprKind::Unary(..)) => {},
35-
(&ExprKind::Unary(UnOp::UnNeg, ref lit), _) => check_mul(cx, e.span, lit, right),
36-
(_, &ExprKind::Unary(UnOp::UnNeg, ref lit)) => check_mul(cx, e.span, lit, left),
35+
(&ExprKind::Unary(UnOp::Neg, ref lit), _) => check_mul(cx, e.span, lit, right),
36+
(_, &ExprKind::Unary(UnOp::Neg, ref lit)) => check_mul(cx, e.span, lit, left),
3737
_ => {},
3838
}
3939
}

Diff for: clippy_lints/src/non_copy_const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst {
383383
needs_check_adjustment = false;
384384
break;
385385
},
386-
ExprKind::Unary(UnOp::UnDeref, _) => {
386+
ExprKind::Unary(UnOp::Deref, _) => {
387387
// `*e` => desugared to `*Deref::deref(&e)`,
388388
// meaning `e` must be referenced.
389389
// no need to go further up since a method call is involved now.

Diff for: clippy_lints/src/option_if_let_else.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ fn detect_option_if_let_else<'tcx>(
181181
};
182182
let cond_expr = match &cond_expr.kind {
183183
// Pointer dereferencing happens automatically, so we can omit it in the suggestion
184-
ExprKind::Unary(UnOp::UnDeref, expr) | ExprKind::AddrOf(_, _, expr) => expr,
184+
ExprKind::Unary(UnOp::Deref, expr) | ExprKind::AddrOf(_, _, expr) => expr,
185185
_ => cond_expr,
186186
};
187187
Some(OptionIfLetElseOccurence {

Diff for: clippy_lints/src/shadow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ fn is_self_shadow(name: Symbol, expr: &Expr<'_>) -> bool {
389389
ExprKind::Block(ref block, _) => {
390390
block.stmts.is_empty() && block.expr.as_ref().map_or(false, |e| is_self_shadow(name, e))
391391
},
392-
ExprKind::Unary(op, ref inner) => (UnOp::UnDeref == op) && is_self_shadow(name, inner),
392+
ExprKind::Unary(op, ref inner) => (UnOp::Deref == op) && is_self_shadow(name, inner),
393393
ExprKind::Path(QPath::Resolved(_, ref path)) => path_eq_name(name, path),
394394
_ => false,
395395
}

Diff for: clippy_lints/src/suspicious_trait_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ impl<'tcx> Visitor<'tcx> for BinaryExprVisitor {
194194
fn visit_expr(&mut self, expr: &'tcx hir::Expr<'_>) {
195195
match expr.kind {
196196
hir::ExprKind::Binary(..)
197-
| hir::ExprKind::Unary(hir::UnOp::UnNot | hir::UnOp::UnNeg, _)
197+
| hir::ExprKind::Unary(hir::UnOp::Not | hir::UnOp::Neg, _)
198198
| hir::ExprKind::AssignOp(..) => self.nb_binops += 1,
199199
_ => {},
200200
}

Diff for: clippy_lints/src/transmute.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ impl<'tcx> LateLintPass<'tcx> for Transmute {
586586
let mut expr = &args[0];
587587
let mut arg = sugg::Sugg::hir(cx, expr, "..");
588588

589-
if let ExprKind::Unary(UnOp::UnNeg, inner_expr) = &expr.kind {
589+
if let ExprKind::Unary(UnOp::Neg, inner_expr) = &expr.kind {
590590
expr = &inner_expr;
591591
}
592592

Diff for: clippy_lints/src/types.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1708,13 +1708,13 @@ impl<'tcx> LateLintPass<'tcx> for Casts {
17081708
}
17091709

17101710
fn is_unary_neg(expr: &Expr<'_>) -> bool {
1711-
matches!(expr.kind, ExprKind::Unary(UnOp::UnNeg, _))
1711+
matches!(expr.kind, ExprKind::Unary(UnOp::Neg, _))
17121712
}
17131713

17141714
fn get_numeric_literal<'e>(expr: &'e Expr<'e>) -> Option<&'e Lit> {
17151715
match expr.kind {
17161716
ExprKind::Lit(ref lit) => Some(lit),
1717-
ExprKind::Unary(UnOp::UnNeg, e) => {
1717+
ExprKind::Unary(UnOp::Neg, e) => {
17181718
if let ExprKind::Lit(ref lit) = e.kind {
17191719
Some(lit)
17201720
} else {
@@ -2870,7 +2870,7 @@ declare_lint_pass!(RefToMut => [CAST_REF_TO_MUT]);
28702870
impl<'tcx> LateLintPass<'tcx> for RefToMut {
28712871
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
28722872
if_chain! {
2873-
if let ExprKind::Unary(UnOp::UnDeref, e) = &expr.kind;
2873+
if let ExprKind::Unary(UnOp::Deref, e) = &expr.kind;
28742874
if let ExprKind::Cast(e, t) = &e.kind;
28752875
if let TyKind::Ptr(MutTy { mutbl: Mutability::Mut, .. }) = t.kind;
28762876
if let ExprKind::Cast(e, t) = &e.kind;

Diff for: clippy_lints/src/unwrap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ fn collect_unwrap_info<'tcx>(
108108
},
109109
_ => (),
110110
}
111-
} else if let ExprKind::Unary(UnOp::UnNot, expr) = &expr.kind {
111+
} else if let ExprKind::Unary(UnOp::Not, expr) = &expr.kind {
112112
return collect_unwrap_info(cx, expr, branch, !invert);
113113
} else {
114114
if_chain! {

Diff for: clippy_lints/src/utils/constants.rs

-13
This file was deleted.

Diff for: clippy_lints/src/utils/higher.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ pub fn extract_assert_macro_args<'tcx>(e: &'tcx Expr<'tcx>) -> Option<Vec<&'tcx
244244
// macros with unique arg: `{debug_}assert!` (e.g., `debug_assert!(some_condition)`)
245245
if_chain! {
246246
if let ExprKind::If(ref clause, _, _) = matchexpr.kind;
247-
if let ExprKind::Unary(UnOp::UnNot, condition) = clause.kind;
247+
if let ExprKind::Unary(UnOp::Not, condition) = clause.kind;
248248
then {
249249
return Some(vec![condition]);
250250
}

0 commit comments

Comments
 (0)