Auto merge of #7994 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
This commit is contained in:
commit
8dd1bce263
@ -5,7 +5,7 @@ use clippy_utils::ty::{implements_trait, is_type_diagnostic_item};
|
||||
use clippy_utils::{is_entrypoint_fn, is_expn_of, match_panic_def_id, method_chain_args, return_ty};
|
||||
use if_chain::if_chain;
|
||||
use itertools::Itertools;
|
||||
use rustc_ast::ast::{Async, AttrKind, Attribute, FnKind, FnRetTy, ItemKind};
|
||||
use rustc_ast::ast::{Async, AttrKind, Attribute, Fn, FnRetTy, ItemKind};
|
||||
use rustc_ast::token::CommentKind;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
@ -644,7 +644,9 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) {
|
||||
| ItemKind::ExternCrate(..)
|
||||
| ItemKind::ForeignMod(..) => return false,
|
||||
// We found a main function ...
|
||||
ItemKind::Fn(box FnKind(_, sig, _, Some(block))) if item.ident.name == sym::main => {
|
||||
ItemKind::Fn(box Fn {
|
||||
sig, body: Some(block), ..
|
||||
}) if item.ident.name == sym::main => {
|
||||
let is_async = matches!(sig.header.asyncness, Async::Yes { .. });
|
||||
let returns_nothing = match &sig.decl.output {
|
||||
FnRetTy::Default(..) => true,
|
||||
|
@ -1,5 +1,5 @@
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use rustc_ast::ast::{AssocItemKind, Extern, FnKind, FnSig, ImplKind, Item, ItemKind, TraitKind, Ty, TyKind};
|
||||
use rustc_ast::ast::{AssocItemKind, Extern, Fn, FnSig, Impl, Item, ItemKind, Trait, Ty, TyKind};
|
||||
use rustc_lint::{EarlyContext, EarlyLintPass};
|
||||
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
||||
use rustc_span::{sym, Span};
|
||||
@ -163,17 +163,17 @@ impl EarlyLintPass for ExcessiveBools {
|
||||
);
|
||||
}
|
||||
},
|
||||
ItemKind::Impl(box ImplKind {
|
||||
ItemKind::Impl(box Impl {
|
||||
of_trait: None, items, ..
|
||||
})
|
||||
| ItemKind::Trait(box TraitKind(.., items)) => {
|
||||
| ItemKind::Trait(box Trait { items, .. }) => {
|
||||
for item in items {
|
||||
if let AssocItemKind::Fn(box FnKind(_, fn_sig, _, _)) = &item.kind {
|
||||
self.check_fn_sig(cx, fn_sig, item.span);
|
||||
if let AssocItemKind::Fn(box Fn { sig, .. }) = &item.kind {
|
||||
self.check_fn_sig(cx, sig, item.span);
|
||||
}
|
||||
}
|
||||
},
|
||||
ItemKind::Fn(box FnKind(_, fn_sig, _, _)) => self.check_fn_sig(cx, fn_sig, item.span),
|
||||
ItemKind::Fn(box Fn { sig, .. }) => self.check_fn_sig(cx, sig, item.span),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
@ -78,13 +78,13 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
|
||||
if is_future {
|
||||
let send_trait = cx.tcx.get_diagnostic_item(sym::Send).unwrap();
|
||||
let span = decl.output.span();
|
||||
let send_result = cx.tcx.infer_ctxt().enter(|infcx| {
|
||||
let send_errors = cx.tcx.infer_ctxt().enter(|infcx| {
|
||||
let cause = traits::ObligationCause::misc(span, hir_id);
|
||||
let mut fulfillment_cx = traits::FulfillmentContext::new();
|
||||
fulfillment_cx.register_bound(&infcx, cx.param_env, ret_ty, send_trait, cause);
|
||||
fulfillment_cx.select_all_or_error(&infcx)
|
||||
});
|
||||
if let Err(send_errors) = send_result {
|
||||
if !send_errors.is_empty() {
|
||||
span_lint_and_then(
|
||||
cx,
|
||||
FUTURE_NOT_SEND,
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#![feature(box_patterns)]
|
||||
#![feature(drain_filter)]
|
||||
#![feature(format_args_capture)]
|
||||
#![feature(in_band_lifetimes)]
|
||||
#![feature(iter_zip)]
|
||||
#![feature(once_cell)]
|
||||
|
@ -1073,7 +1073,10 @@ fn check_wild_enum_match(cx: &LateContext<'_>, ex: &Expr<'_>, arms: &[Arm<'_>])
|
||||
PatKind::Path(path) => {
|
||||
#[allow(clippy::match_same_arms)]
|
||||
let id = match cx.qpath_res(path, pat.hir_id) {
|
||||
Res::Def(DefKind::Const | DefKind::ConstParam | DefKind::AnonConst, _) => return,
|
||||
Res::Def(
|
||||
DefKind::Const | DefKind::ConstParam | DefKind::AnonConst | DefKind::InlineConst,
|
||||
_,
|
||||
) => return,
|
||||
Res::Def(_, id) => id,
|
||||
_ => return,
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_then};
|
||||
use rustc_ast::ast::{
|
||||
Arm, AssocItem, AssocItemKind, Attribute, Block, FnDecl, FnKind, Item, ItemKind, Local, Pat, PatKind,
|
||||
self, Arm, AssocItem, AssocItemKind, Attribute, Block, FnDecl, Item, ItemKind, Local, Pat, PatKind,
|
||||
};
|
||||
use rustc_ast::visit::{walk_block, walk_expr, walk_pat, Visitor};
|
||||
use rustc_lint::{EarlyContext, EarlyLintPass};
|
||||
@ -360,7 +360,12 @@ impl EarlyLintPass for NonExpressiveNames {
|
||||
return;
|
||||
}
|
||||
|
||||
if let ItemKind::Fn(box FnKind(_, ref sig, _, Some(ref blk))) = item.kind {
|
||||
if let ItemKind::Fn(box ast::Fn {
|
||||
ref sig,
|
||||
body: Some(ref blk),
|
||||
..
|
||||
}) = item.kind
|
||||
{
|
||||
do_check(self, cx, &item.attrs, &sig.decl, blk);
|
||||
}
|
||||
}
|
||||
@ -370,7 +375,12 @@ impl EarlyLintPass for NonExpressiveNames {
|
||||
return;
|
||||
}
|
||||
|
||||
if let AssocItemKind::Fn(box FnKind(_, ref sig, _, Some(ref blk))) = item.kind {
|
||||
if let AssocItemKind::Fn(box ast::Fn {
|
||||
ref sig,
|
||||
body: Some(ref blk),
|
||||
..
|
||||
}) = item.kind
|
||||
{
|
||||
do_check(self, cx, &item.attrs, &sig.decl, blk);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ use std::ops::{Deref, Range};
|
||||
|
||||
use clippy_utils::diagnostics::{span_lint, span_lint_and_sugg, span_lint_and_then};
|
||||
use clippy_utils::source::{snippet_opt, snippet_with_applicability};
|
||||
use rustc_ast::ast::{Expr, ExprKind, ImplKind, Item, ItemKind, MacCall, Path, StrLit, StrStyle};
|
||||
use rustc_ast::ast::{Expr, ExprKind, Impl, Item, ItemKind, MacCall, Path, StrLit, StrStyle};
|
||||
use rustc_ast::token::{self, LitKind};
|
||||
use rustc_ast::tokenstream::TokenStream;
|
||||
use rustc_errors::Applicability;
|
||||
@ -252,7 +252,7 @@ impl_lint_pass!(Write => [
|
||||
|
||||
impl EarlyLintPass for Write {
|
||||
fn check_item(&mut self, _: &EarlyContext<'_>, item: &Item) {
|
||||
if let ItemKind::Impl(box ImplKind {
|
||||
if let ItemKind::Impl(box Impl {
|
||||
of_trait: Some(trait_ref),
|
||||
..
|
||||
}) = &item.kind
|
||||
|
@ -243,6 +243,7 @@ pub fn eq_item<K>(l: &Item<K>, r: &Item<K>, mut eq_kind: impl FnMut(&K, &K) -> b
|
||||
eq_id(l.ident, r.ident) && over(&l.attrs, &r.attrs, eq_attr) && eq_vis(&l.vis, &r.vis) && eq_kind(&l.kind, &r.kind)
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_lines)] // Just a big match statement
|
||||
pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
|
||||
use ItemKind::*;
|
||||
match (l, r) {
|
||||
@ -250,7 +251,20 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
|
||||
(Use(l), Use(r)) => eq_use_tree(l, r),
|
||||
(Static(lt, lm, le), Static(rt, rm, re)) => lm == rm && eq_ty(lt, rt) && eq_expr_opt(le, re),
|
||||
(Const(ld, lt, le), Const(rd, rt, re)) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
|
||||
(Fn(box FnKind(ld, lf, lg, lb)), Fn(box FnKind(rd, rf, rg, rb))) => {
|
||||
(
|
||||
Fn(box ast::Fn {
|
||||
defaultness: ld,
|
||||
sig: lf,
|
||||
generics: lg,
|
||||
body: lb,
|
||||
}),
|
||||
Fn(box ast::Fn {
|
||||
defaultness: rd,
|
||||
sig: rf,
|
||||
generics: rg,
|
||||
body: rb,
|
||||
}),
|
||||
) => {
|
||||
eq_defaultness(*ld, *rd) && eq_fn_sig(lf, rf) && eq_generics(lg, rg) && both(lb, rb, |l, r| eq_block(l, r))
|
||||
},
|
||||
(Mod(lu, lmk), Mod(ru, rmk)) => {
|
||||
@ -266,7 +280,20 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
|
||||
(ForeignMod(l), ForeignMod(r)) => {
|
||||
both(&l.abi, &r.abi, eq_str_lit) && over(&l.items, &r.items, |l, r| eq_item(l, r, eq_foreign_item_kind))
|
||||
},
|
||||
(TyAlias(box TyAliasKind(ld, lg, lb, lt)), TyAlias(box TyAliasKind(rd, rg, rb, rt))) => {
|
||||
(
|
||||
TyAlias(box ast::TyAlias {
|
||||
defaultness: ld,
|
||||
generics: lg,
|
||||
bounds: lb,
|
||||
ty: lt,
|
||||
}),
|
||||
TyAlias(box ast::TyAlias {
|
||||
defaultness: rd,
|
||||
generics: rg,
|
||||
bounds: rb,
|
||||
ty: rt,
|
||||
}),
|
||||
) => {
|
||||
eq_defaultness(*ld, *rd)
|
||||
&& eq_generics(lg, rg)
|
||||
&& over(lb, rb, eq_generic_bound)
|
||||
@ -276,7 +303,22 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
|
||||
(Struct(lv, lg), Struct(rv, rg)) | (Union(lv, lg), Union(rv, rg)) => {
|
||||
eq_variant_data(lv, rv) && eq_generics(lg, rg)
|
||||
},
|
||||
(Trait(box TraitKind(la, lu, lg, lb, li)), Trait(box TraitKind(ra, ru, rg, rb, ri))) => {
|
||||
(
|
||||
Trait(box ast::Trait {
|
||||
is_auto: la,
|
||||
unsafety: lu,
|
||||
generics: lg,
|
||||
bounds: lb,
|
||||
items: li,
|
||||
}),
|
||||
Trait(box ast::Trait {
|
||||
is_auto: ra,
|
||||
unsafety: ru,
|
||||
generics: rg,
|
||||
bounds: rb,
|
||||
items: ri,
|
||||
}),
|
||||
) => {
|
||||
la == ra
|
||||
&& matches!(lu, Unsafe::No) == matches!(ru, Unsafe::No)
|
||||
&& eq_generics(lg, rg)
|
||||
@ -285,7 +327,7 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
|
||||
},
|
||||
(TraitAlias(lg, lb), TraitAlias(rg, rb)) => eq_generics(lg, rg) && over(lb, rb, eq_generic_bound),
|
||||
(
|
||||
Impl(box ImplKind {
|
||||
Impl(box ast::Impl {
|
||||
unsafety: lu,
|
||||
polarity: lp,
|
||||
defaultness: ld,
|
||||
@ -295,7 +337,7 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
|
||||
self_ty: lst,
|
||||
items: li,
|
||||
}),
|
||||
Impl(box ImplKind {
|
||||
Impl(box ast::Impl {
|
||||
unsafety: ru,
|
||||
polarity: rp,
|
||||
defaultness: rd,
|
||||
@ -325,10 +367,36 @@ pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
|
||||
use ForeignItemKind::*;
|
||||
match (l, r) {
|
||||
(Static(lt, lm, le), Static(rt, rm, re)) => lm == rm && eq_ty(lt, rt) && eq_expr_opt(le, re),
|
||||
(Fn(box FnKind(ld, lf, lg, lb)), Fn(box FnKind(rd, rf, rg, rb))) => {
|
||||
(
|
||||
Fn(box ast::Fn {
|
||||
defaultness: ld,
|
||||
sig: lf,
|
||||
generics: lg,
|
||||
body: lb,
|
||||
}),
|
||||
Fn(box ast::Fn {
|
||||
defaultness: rd,
|
||||
sig: rf,
|
||||
generics: rg,
|
||||
body: rb,
|
||||
}),
|
||||
) => {
|
||||
eq_defaultness(*ld, *rd) && eq_fn_sig(lf, rf) && eq_generics(lg, rg) && both(lb, rb, |l, r| eq_block(l, r))
|
||||
},
|
||||
(TyAlias(box TyAliasKind(ld, lg, lb, lt)), TyAlias(box TyAliasKind(rd, rg, rb, rt))) => {
|
||||
(
|
||||
TyAlias(box ast::TyAlias {
|
||||
defaultness: ld,
|
||||
generics: lg,
|
||||
bounds: lb,
|
||||
ty: lt,
|
||||
}),
|
||||
TyAlias(box ast::TyAlias {
|
||||
defaultness: rd,
|
||||
generics: rg,
|
||||
bounds: rb,
|
||||
ty: rt,
|
||||
}),
|
||||
) => {
|
||||
eq_defaultness(*ld, *rd)
|
||||
&& eq_generics(lg, rg)
|
||||
&& over(lb, rb, eq_generic_bound)
|
||||
@ -343,10 +411,36 @@ pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
|
||||
use AssocItemKind::*;
|
||||
match (l, r) {
|
||||
(Const(ld, lt, le), Const(rd, rt, re)) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
|
||||
(Fn(box FnKind(ld, lf, lg, lb)), Fn(box FnKind(rd, rf, rg, rb))) => {
|
||||
(
|
||||
Fn(box ast::Fn {
|
||||
defaultness: ld,
|
||||
sig: lf,
|
||||
generics: lg,
|
||||
body: lb,
|
||||
}),
|
||||
Fn(box ast::Fn {
|
||||
defaultness: rd,
|
||||
sig: rf,
|
||||
generics: rg,
|
||||
body: rb,
|
||||
}),
|
||||
) => {
|
||||
eq_defaultness(*ld, *rd) && eq_fn_sig(lf, rf) && eq_generics(lg, rg) && both(lb, rb, |l, r| eq_block(l, r))
|
||||
},
|
||||
(TyAlias(box TyAliasKind(ld, lg, lb, lt)), TyAlias(box TyAliasKind(rd, rg, rb, rt))) => {
|
||||
(
|
||||
TyAlias(box ast::TyAlias {
|
||||
defaultness: ld,
|
||||
generics: lg,
|
||||
bounds: lb,
|
||||
ty: lt,
|
||||
}),
|
||||
TyAlias(box ast::TyAlias {
|
||||
defaultness: rd,
|
||||
generics: rg,
|
||||
bounds: rb,
|
||||
ty: rt,
|
||||
}),
|
||||
) => {
|
||||
eq_defaultness(*ld, *rd)
|
||||
&& eq_generics(lg, rg)
|
||||
&& over(lb, rb, eq_generic_bound)
|
||||
|
@ -3,12 +3,12 @@
|
||||
#![deny(clippy::missing_docs_in_private_items)]
|
||||
|
||||
use crate::ty::is_type_diagnostic_item;
|
||||
use crate::{is_expn_of, last_path_segment, match_def_path, path_to_local_id, paths};
|
||||
use crate::{is_expn_of, last_path_segment, match_def_path, paths};
|
||||
use if_chain::if_chain;
|
||||
use rustc_ast::ast::{self, LitKind};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::{
|
||||
Arm, Block, BorrowKind, Expr, ExprKind, HirId, LoopSource, MatchSource, Node, Pat, PatKind, QPath, StmtKind, UnOp,
|
||||
Arm, Block, BorrowKind, Expr, ExprKind, HirId, LoopSource, MatchSource, Node, Pat, QPath, StmtKind, UnOp,
|
||||
};
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_span::{sym, symbol, ExpnKind, Span, Symbol};
|
||||
@ -513,8 +513,6 @@ pub struct FormatArgsExpn<'tcx> {
|
||||
pub format_string_parts: &'tcx [Expr<'tcx>],
|
||||
/// Symbols corresponding to [`Self::format_string_parts`]
|
||||
pub format_string_symbols: Vec<Symbol>,
|
||||
/// Match arm patterns, the `arg0`, etc. from the next field `args`
|
||||
pub arg_names: &'tcx [Pat<'tcx>],
|
||||
/// Expressions like `ArgumentV1::new(arg0, Debug::fmt)`
|
||||
pub args: &'tcx [Expr<'tcx>],
|
||||
/// The final argument passed to `Arguments::new_v1_formatted`, if applicable
|
||||
@ -559,7 +557,6 @@ impl FormatArgsExpn<'tcx> {
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
if let PatKind::Tuple(arg_names, None) = arm.pat.kind;
|
||||
if let ExprKind::Array(args) = arm.body.kind;
|
||||
then {
|
||||
Some(FormatArgsExpn {
|
||||
@ -567,7 +564,6 @@ impl FormatArgsExpn<'tcx> {
|
||||
value_args,
|
||||
format_string_parts,
|
||||
format_string_symbols,
|
||||
arg_names,
|
||||
args,
|
||||
fmt_expr,
|
||||
})
|
||||
@ -594,10 +590,8 @@ impl FormatArgsExpn<'tcx> {
|
||||
if let Ok(i) = usize::try_from(position);
|
||||
let arg = &self.args[i];
|
||||
if let ExprKind::Call(_, [arg_name, _]) = arg.kind;
|
||||
if let Some(j) = self
|
||||
.arg_names
|
||||
.iter()
|
||||
.position(|pat| path_to_local_id(arg_name, pat.hir_id));
|
||||
if let ExprKind::Field(_, j) = arg_name.kind;
|
||||
if let Ok(j) = j.name.as_str().parse::<usize>();
|
||||
then {
|
||||
Some(FormatArgsArg { value: self.value_args[j], arg, fmt: Some(fmt) })
|
||||
} else {
|
||||
|
@ -1,3 +1,3 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2021-11-04"
|
||||
channel = "nightly-2021-11-18"
|
||||
components = ["llvm-tools-preview", "rustc-dev", "rust-src", "rustfmt"]
|
||||
|
@ -1,3 +1,4 @@
|
||||
#![allow(clippy::excessive_precision)]
|
||||
#[deny(clippy::unreadable_literal)]
|
||||
|
||||
fn allow_inconsistent_digit_grouping() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: digits grouped inconsistently by underscores
|
||||
--> $DIR/test.rs:18:18
|
||||
--> $DIR/test.rs:19:18
|
||||
|
|
||||
LL | let _fail1 = 100_200_300.123456789;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: consider: `100_200_300.123_456_789`
|
||||
|
@ -52,12 +52,14 @@ macro_rules! m_mut {
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct S;
|
||||
impl S {
|
||||
pub fn f(&self) -> &Self {
|
||||
m!(self)
|
||||
}
|
||||
pub fn f_mut(&self) -> &Self {
|
||||
#[allow(unused_mut)] // mut will be unused, once the macro is fixed
|
||||
pub fn f_mut(mut self) -> Self {
|
||||
m_mut!(self)
|
||||
}
|
||||
}
|
||||
|
@ -52,12 +52,14 @@ macro_rules! m_mut {
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct S;
|
||||
impl S {
|
||||
pub fn f(&self) -> &Self {
|
||||
m!(self)
|
||||
}
|
||||
pub fn f_mut(&self) -> &Self {
|
||||
#[allow(unused_mut)] // mut will be unused, once the macro is fixed
|
||||
pub fn f_mut(mut self) -> Self {
|
||||
m_mut!(self)
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[warn(clippy::double_neg)]
|
||||
#[allow(clippy::no_effect)]
|
||||
fn main() {
|
||||
let x = 1;
|
||||
-x;
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: `--x` could be misinterpreted as pre-decrement by C programmers, is usually a no-op
|
||||
--> $DIR/double_neg.rs:6:5
|
||||
--> $DIR/double_neg.rs:7:5
|
||||
|
|
||||
LL | --x;
|
||||
| ^^^
|
||||
|
@ -1,4 +1,5 @@
|
||||
#![warn(clippy::fn_params_excessive_bools)]
|
||||
#![allow(clippy::too_many_arguments)]
|
||||
|
||||
extern "C" {
|
||||
fn f(_: bool, _: bool, _: bool, _: bool);
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: more than 3 bools in function parameters
|
||||
--> $DIR/fn_params_excessive_bools.rs:17:1
|
||||
--> $DIR/fn_params_excessive_bools.rs:18:1
|
||||
|
|
||||
LL | fn g(_: bool, _: bool, _: bool, _: bool) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -8,7 +8,7 @@ LL | fn g(_: bool, _: bool, _: bool, _: bool) {}
|
||||
= help: consider refactoring bools into two-variant enums
|
||||
|
||||
error: more than 3 bools in function parameters
|
||||
--> $DIR/fn_params_excessive_bools.rs:20:1
|
||||
--> $DIR/fn_params_excessive_bools.rs:21:1
|
||||
|
|
||||
LL | fn t(_: S, _: S, _: Box<S>, _: Vec<u32>, _: bool, _: bool, _: bool, _: bool) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -16,7 +16,7 @@ LL | fn t(_: S, _: S, _: Box<S>, _: Vec<u32>, _: bool, _: bool, _: bool, _: bool
|
||||
= help: consider refactoring bools into two-variant enums
|
||||
|
||||
error: more than 3 bools in function parameters
|
||||
--> $DIR/fn_params_excessive_bools.rs:24:5
|
||||
--> $DIR/fn_params_excessive_bools.rs:25:5
|
||||
|
|
||||
LL | fn f(_: bool, _: bool, _: bool, _: bool);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -24,7 +24,7 @@ LL | fn f(_: bool, _: bool, _: bool, _: bool);
|
||||
= help: consider refactoring bools into two-variant enums
|
||||
|
||||
error: more than 3 bools in function parameters
|
||||
--> $DIR/fn_params_excessive_bools.rs:29:5
|
||||
--> $DIR/fn_params_excessive_bools.rs:30:5
|
||||
|
|
||||
LL | fn f(&self, _: bool, _: bool, _: bool, _: bool) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -32,7 +32,7 @@ LL | fn f(&self, _: bool, _: bool, _: bool, _: bool) {}
|
||||
= help: consider refactoring bools into two-variant enums
|
||||
|
||||
error: more than 3 bools in function parameters
|
||||
--> $DIR/fn_params_excessive_bools.rs:41:5
|
||||
--> $DIR/fn_params_excessive_bools.rs:42:5
|
||||
|
|
||||
LL | / fn n(_: bool, _: u32, _: bool, _: Box<u32>, _: bool, _: bool) {
|
||||
LL | | fn nn(_: bool, _: bool, _: bool, _: bool) {}
|
||||
@ -42,7 +42,7 @@ LL | | }
|
||||
= help: consider refactoring bools into two-variant enums
|
||||
|
||||
error: more than 3 bools in function parameters
|
||||
--> $DIR/fn_params_excessive_bools.rs:42:9
|
||||
--> $DIR/fn_params_excessive_bools.rs:43:9
|
||||
|
|
||||
LL | fn nn(_: bool, _: bool, _: bool, _: bool) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -3,6 +3,7 @@
|
||||
#![allow(unused_assignments)]
|
||||
#![allow(clippy::if_same_then_else)]
|
||||
#![allow(clippy::deref_addrof)]
|
||||
#![allow(clippy::nonminimal_bool)]
|
||||
|
||||
fn foo() -> bool {
|
||||
true
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this looks like you are trying to use `.. -= ..`, but you really are doing `.. = (- ..)`
|
||||
--> $DIR/formatting.rs:15:6
|
||||
--> $DIR/formatting.rs:16:6
|
||||
|
|
||||
LL | a =- 35;
|
||||
| ^^^^
|
||||
@ -8,7 +8,7 @@ LL | a =- 35;
|
||||
= note: to remove this lint, use either `-=` or `= -`
|
||||
|
||||
error: this looks like you are trying to use `.. *= ..`, but you really are doing `.. = (* ..)`
|
||||
--> $DIR/formatting.rs:16:6
|
||||
--> $DIR/formatting.rs:17:6
|
||||
|
|
||||
LL | a =* &191;
|
||||
| ^^^^
|
||||
@ -16,7 +16,7 @@ LL | a =* &191;
|
||||
= note: to remove this lint, use either `*=` or `= *`
|
||||
|
||||
error: this looks like you are trying to use `.. != ..`, but you really are doing `.. = (! ..)`
|
||||
--> $DIR/formatting.rs:19:6
|
||||
--> $DIR/formatting.rs:20:6
|
||||
|
|
||||
LL | b =! false;
|
||||
| ^^^^
|
||||
@ -24,7 +24,7 @@ LL | b =! false;
|
||||
= note: to remove this lint, use either `!=` or `= !`
|
||||
|
||||
error: possibly missing a comma here
|
||||
--> $DIR/formatting.rs:28:19
|
||||
--> $DIR/formatting.rs:29:19
|
||||
|
|
||||
LL | -1, -2, -3 // <= no comma here
|
||||
| ^
|
||||
@ -33,7 +33,7 @@ LL | -1, -2, -3 // <= no comma here
|
||||
= note: to remove this lint, add a comma or write the expr in a single line
|
||||
|
||||
error: possibly missing a comma here
|
||||
--> $DIR/formatting.rs:32:19
|
||||
--> $DIR/formatting.rs:33:19
|
||||
|
|
||||
LL | -1, -2, -3 // <= no comma here
|
||||
| ^
|
||||
@ -41,7 +41,7 @@ LL | -1, -2, -3 // <= no comma here
|
||||
= note: to remove this lint, add a comma or write the expr in a single line
|
||||
|
||||
error: possibly missing a comma here
|
||||
--> $DIR/formatting.rs:69:11
|
||||
--> $DIR/formatting.rs:70:11
|
||||
|
|
||||
LL | -1
|
||||
| ^
|
||||
|
@ -4,7 +4,7 @@
|
||||
#![warn(clippy::zero_prefixed_literal)]
|
||||
#![warn(clippy::unseparated_literal_suffix)]
|
||||
#![warn(clippy::separated_literal_suffix)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(dead_code, overflowing_literals)]
|
||||
|
||||
fn main() {
|
||||
let ok1 = 0xABCD;
|
||||
|
@ -1,3 +1,4 @@
|
||||
#![allow(clippy::too_many_arguments, clippy::diverging_sub_expression)]
|
||||
#![warn(clippy::many_single_char_names)]
|
||||
|
||||
fn bla() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: 5 bindings with single-character names in scope
|
||||
--> $DIR/many_single_char_names.rs:4:9
|
||||
--> $DIR/many_single_char_names.rs:5:9
|
||||
|
|
||||
LL | let a: i32;
|
||||
| ^
|
||||
@ -12,7 +12,7 @@ LL | let e: i32;
|
||||
= note: `-D clippy::many-single-char-names` implied by `-D warnings`
|
||||
|
||||
error: 6 bindings with single-character names in scope
|
||||
--> $DIR/many_single_char_names.rs:4:9
|
||||
--> $DIR/many_single_char_names.rs:5:9
|
||||
|
|
||||
LL | let a: i32;
|
||||
| ^
|
||||
@ -25,7 +25,7 @@ LL | let f: i32;
|
||||
| ^
|
||||
|
||||
error: 5 bindings with single-character names in scope
|
||||
--> $DIR/many_single_char_names.rs:4:9
|
||||
--> $DIR/many_single_char_names.rs:5:9
|
||||
|
|
||||
LL | let a: i32;
|
||||
| ^
|
||||
@ -36,13 +36,13 @@ LL | e => panic!(),
|
||||
| ^
|
||||
|
||||
error: 8 bindings with single-character names in scope
|
||||
--> $DIR/many_single_char_names.rs:29:13
|
||||
--> $DIR/many_single_char_names.rs:30:13
|
||||
|
|
||||
LL | fn bindings(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) {}
|
||||
| ^ ^ ^ ^ ^ ^ ^ ^
|
||||
|
||||
error: 8 bindings with single-character names in scope
|
||||
--> $DIR/many_single_char_names.rs:32:10
|
||||
--> $DIR/many_single_char_names.rs:33:10
|
||||
|
|
||||
LL | let (a, b, c, d, e, f, g, h): (bool, bool, bool, bool, bool, bool, bool, bool) = unimplemented!();
|
||||
| ^ ^ ^ ^ ^ ^ ^ ^
|
||||
|
@ -3,6 +3,7 @@
|
||||
#![allow(
|
||||
dead_code,
|
||||
unused_variables,
|
||||
overflowing_literals,
|
||||
clippy::excessive_precision,
|
||||
clippy::inconsistent_digit_grouping
|
||||
)]
|
||||
@ -21,7 +22,6 @@ fn main() {
|
||||
let fail25 = 1E2_f32;
|
||||
let fail26 = 43E7_f64;
|
||||
let fail27 = 243E17_f32;
|
||||
#[allow(overflowing_literals)]
|
||||
let fail28 = 241_251_235E723_f64;
|
||||
let ok29 = 42279.911_32;
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#![allow(
|
||||
dead_code,
|
||||
unused_variables,
|
||||
overflowing_literals,
|
||||
clippy::excessive_precision,
|
||||
clippy::inconsistent_digit_grouping
|
||||
)]
|
||||
@ -21,7 +22,6 @@ fn main() {
|
||||
let fail25 = 1E2_32;
|
||||
let fail26 = 43E7_64;
|
||||
let fail27 = 243E17_32;
|
||||
#[allow(overflowing_literals)]
|
||||
let fail28 = 241251235E723_64;
|
||||
let ok29 = 42279.911_32;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:11:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:12:18
|
||||
|
|
||||
LL | let fail14 = 2_32;
|
||||
| ^^^^ help: did you mean to write: `2_i32`
|
||||
@ -7,49 +7,49 @@ LL | let fail14 = 2_32;
|
||||
= note: `#[deny(clippy::mistyped_literal_suffixes)]` on by default
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:12:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:13:18
|
||||
|
|
||||
LL | let fail15 = 4_64;
|
||||
| ^^^^ help: did you mean to write: `4_i64`
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:13:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:14:18
|
||||
|
|
||||
LL | let fail16 = 7_8; //
|
||||
| ^^^ help: did you mean to write: `7_i8`
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:14:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:15:18
|
||||
|
|
||||
LL | let fail17 = 23_16; //
|
||||
| ^^^^^ help: did you mean to write: `23_i16`
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:17:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:18:18
|
||||
|
|
||||
LL | let fail20 = 2__8; //
|
||||
| ^^^^ help: did you mean to write: `2_i8`
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:18:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:19:18
|
||||
|
|
||||
LL | let fail21 = 4___16; //
|
||||
| ^^^^^^ help: did you mean to write: `4_i16`
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:21:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:22:18
|
||||
|
|
||||
LL | let fail25 = 1E2_32;
|
||||
| ^^^^^^ help: did you mean to write: `1E2_f32`
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:22:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:23:18
|
||||
|
|
||||
LL | let fail26 = 43E7_64;
|
||||
| ^^^^^^^ help: did you mean to write: `43E7_f64`
|
||||
|
||||
error: mistyped literal suffix
|
||||
--> $DIR/mistyped_literal_suffix.rs:23:18
|
||||
--> $DIR/mistyped_literal_suffix.rs:24:18
|
||||
|
|
||||
LL | let fail27 = 243E17_32;
|
||||
| ^^^^^^^^^ help: did you mean to write: `243E17_f32`
|
||||
|
@ -38,6 +38,7 @@ mod issue_6089 {
|
||||
// fn call_with_mut_self<'life0>(self: &'life0 mut Self) {}
|
||||
#[rename_my_lifetimes]
|
||||
impl T2 for S2 {
|
||||
#[allow(clippy::needless_lifetimes)]
|
||||
fn call_with_mut_self(self: &mut Self) {}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: the type of the `self` parameter does not need to be arbitrary
|
||||
--> $DIR/needless_arbitrary_self_type_unfixable.rs:41:31
|
||||
--> $DIR/needless_arbitrary_self_type_unfixable.rs:42:31
|
||||
|
|
||||
LL | fn call_with_mut_self(self: &mut Self) {}
|
||||
| ^^^^^^^^^^^^^^^ help: consider to change this parameter to: `&'_ mut self`
|
||||
|
@ -12,6 +12,7 @@ macro_rules! nonzero {
|
||||
};
|
||||
}
|
||||
|
||||
#[allow(clippy::nonminimal_bool)]
|
||||
fn main() {
|
||||
let mut i = 1;
|
||||
while i < 10 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this `else` block is redundant
|
||||
--> $DIR/needless_continue.rs:28:16
|
||||
--> $DIR/needless_continue.rs:29:16
|
||||
|
|
||||
LL | } else {
|
||||
| ________________^
|
||||
@ -35,7 +35,7 @@ LL | | }
|
||||
}
|
||||
|
||||
error: there is no need for an explicit `else` block for this `if` expression
|
||||
--> $DIR/needless_continue.rs:43:9
|
||||
--> $DIR/needless_continue.rs:44:9
|
||||
|
|
||||
LL | / if (zero!(i % 2) || nonzero!(i % 5)) && i % 3 != 0 {
|
||||
LL | | continue;
|
||||
@ -55,7 +55,7 @@ LL | | }
|
||||
}
|
||||
|
||||
error: this `continue` expression is redundant
|
||||
--> $DIR/needless_continue.rs:56:9
|
||||
--> $DIR/needless_continue.rs:57:9
|
||||
|
|
||||
LL | continue; // should lint here
|
||||
| ^^^^^^^^^
|
||||
@ -63,7 +63,7 @@ LL | continue; // should lint here
|
||||
= help: consider dropping the `continue` expression
|
||||
|
||||
error: this `continue` expression is redundant
|
||||
--> $DIR/needless_continue.rs:63:9
|
||||
--> $DIR/needless_continue.rs:64:9
|
||||
|
|
||||
LL | continue; // should lint here
|
||||
| ^^^^^^^^^
|
||||
@ -71,7 +71,7 @@ LL | continue; // should lint here
|
||||
= help: consider dropping the `continue` expression
|
||||
|
||||
error: this `continue` expression is redundant
|
||||
--> $DIR/needless_continue.rs:70:9
|
||||
--> $DIR/needless_continue.rs:71:9
|
||||
|
|
||||
LL | continue // should lint here
|
||||
| ^^^^^^^^
|
||||
@ -79,7 +79,7 @@ LL | continue // should lint here
|
||||
= help: consider dropping the `continue` expression
|
||||
|
||||
error: this `continue` expression is redundant
|
||||
--> $DIR/needless_continue.rs:78:9
|
||||
--> $DIR/needless_continue.rs:79:9
|
||||
|
|
||||
LL | continue // should lint here
|
||||
| ^^^^^^^^
|
||||
@ -87,7 +87,7 @@ LL | continue // should lint here
|
||||
= help: consider dropping the `continue` expression
|
||||
|
||||
error: this `else` block is redundant
|
||||
--> $DIR/needless_continue.rs:128:24
|
||||
--> $DIR/needless_continue.rs:129:24
|
||||
|
|
||||
LL | } else {
|
||||
| ________________________^
|
||||
@ -110,7 +110,7 @@ LL | | }
|
||||
}
|
||||
|
||||
error: there is no need for an explicit `else` block for this `if` expression
|
||||
--> $DIR/needless_continue.rs:134:17
|
||||
--> $DIR/needless_continue.rs:135:17
|
||||
|
|
||||
LL | / if condition() {
|
||||
LL | | continue; // should lint here
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![warn(clippy::all)]
|
||||
#![allow(unused, clippy::println_empty_string)]
|
||||
#![allow(unused, clippy::println_empty_string, non_snake_case)]
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
enum MaybeInst {
|
||||
@ -14,6 +14,7 @@ struct InstSplit {
|
||||
|
||||
impl MaybeInst {
|
||||
fn fill(&mut self) {
|
||||
#[allow(non_fmt_panics)]
|
||||
let filled = match *self {
|
||||
MaybeInst::Split1(goto1) => panic!("1"),
|
||||
MaybeInst::Split2(goto2) => panic!("2"),
|
||||
@ -36,6 +37,7 @@ fn issue2927() {
|
||||
}
|
||||
|
||||
fn issue3078() {
|
||||
#[allow(clippy::single_match)]
|
||||
match "a" {
|
||||
stringify!(a) => {},
|
||||
_ => {},
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: consider choosing a more descriptive name
|
||||
--> $DIR/non_expressive_names.rs:27:9
|
||||
--> $DIR/non_expressive_names.rs:28:9
|
||||
|
|
||||
LL | let _1 = 1; //~ERROR Consider a more descriptive name
|
||||
| ^^
|
||||
@ -7,31 +7,31 @@ LL | let _1 = 1; //~ERROR Consider a more descriptive name
|
||||
= note: `-D clippy::just-underscores-and-digits` implied by `-D warnings`
|
||||
|
||||
error: consider choosing a more descriptive name
|
||||
--> $DIR/non_expressive_names.rs:28:9
|
||||
--> $DIR/non_expressive_names.rs:29:9
|
||||
|
|
||||
LL | let ____1 = 1; //~ERROR Consider a more descriptive name
|
||||
| ^^^^^
|
||||
|
||||
error: consider choosing a more descriptive name
|
||||
--> $DIR/non_expressive_names.rs:29:9
|
||||
--> $DIR/non_expressive_names.rs:30:9
|
||||
|
|
||||
LL | let __1___2 = 12; //~ERROR Consider a more descriptive name
|
||||
| ^^^^^^^
|
||||
|
||||
error: consider choosing a more descriptive name
|
||||
--> $DIR/non_expressive_names.rs:49:13
|
||||
--> $DIR/non_expressive_names.rs:51:13
|
||||
|
|
||||
LL | let _1 = 1;
|
||||
| ^^
|
||||
|
||||
error: consider choosing a more descriptive name
|
||||
--> $DIR/non_expressive_names.rs:50:13
|
||||
--> $DIR/non_expressive_names.rs:52:13
|
||||
|
|
||||
LL | let ____1 = 1;
|
||||
| ^^^^^
|
||||
|
||||
error: consider choosing a more descriptive name
|
||||
--> $DIR/non_expressive_names.rs:51:13
|
||||
--> $DIR/non_expressive_names.rs:53:13
|
||||
|
|
||||
LL | let __1___2 = 12;
|
||||
| ^^^^^^^
|
||||
|
@ -15,5 +15,6 @@ fn main() {
|
||||
#[allow(clippy::needless_return)]
|
||||
(|| return 2)();
|
||||
(|| -> Option<i32> { None? })();
|
||||
#[allow(clippy::try_err)]
|
||||
(|| -> Result<i32, i32> { Err(2)? })();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![warn(clippy::redundant_else)]
|
||||
#![allow(clippy::needless_return)]
|
||||
#![allow(clippy::needless_return, clippy::if_same_then_else)]
|
||||
|
||||
fn main() {
|
||||
loop {
|
||||
@ -105,7 +105,7 @@ fn main() {
|
||||
1
|
||||
};
|
||||
// assign
|
||||
let a;
|
||||
let mut a;
|
||||
a = if foo() {
|
||||
return;
|
||||
} else {
|
||||
|
@ -1,5 +1,10 @@
|
||||
#![warn(clippy::similar_names)]
|
||||
#![allow(unused, clippy::println_empty_string)]
|
||||
#![allow(
|
||||
unused,
|
||||
clippy::println_empty_string,
|
||||
clippy::empty_loop,
|
||||
clippy::diverging_sub_expression
|
||||
)]
|
||||
|
||||
struct Foo {
|
||||
apple: i32,
|
||||
|
@ -1,84 +1,84 @@
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:15:9
|
||||
--> $DIR/similar_names.rs:20:9
|
||||
|
|
||||
LL | let bpple: i32;
|
||||
| ^^^^^
|
||||
|
|
||||
= note: `-D clippy::similar-names` implied by `-D warnings`
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:13:9
|
||||
--> $DIR/similar_names.rs:18:9
|
||||
|
|
||||
LL | let apple: i32;
|
||||
| ^^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:17:9
|
||||
--> $DIR/similar_names.rs:22:9
|
||||
|
|
||||
LL | let cpple: i32;
|
||||
| ^^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:13:9
|
||||
--> $DIR/similar_names.rs:18:9
|
||||
|
|
||||
LL | let apple: i32;
|
||||
| ^^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:41:9
|
||||
--> $DIR/similar_names.rs:46:9
|
||||
|
|
||||
LL | let bluby: i32;
|
||||
| ^^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:40:9
|
||||
--> $DIR/similar_names.rs:45:9
|
||||
|
|
||||
LL | let blubx: i32;
|
||||
| ^^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:45:9
|
||||
--> $DIR/similar_names.rs:50:9
|
||||
|
|
||||
LL | let coke: i32;
|
||||
| ^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:43:9
|
||||
--> $DIR/similar_names.rs:48:9
|
||||
|
|
||||
LL | let cake: i32;
|
||||
| ^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:63:9
|
||||
--> $DIR/similar_names.rs:68:9
|
||||
|
|
||||
LL | let xyzeabc: i32;
|
||||
| ^^^^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:61:9
|
||||
--> $DIR/similar_names.rs:66:9
|
||||
|
|
||||
LL | let xyz1abc: i32;
|
||||
| ^^^^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:67:9
|
||||
--> $DIR/similar_names.rs:72:9
|
||||
|
|
||||
LL | let parsee: i32;
|
||||
| ^^^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:65:9
|
||||
--> $DIR/similar_names.rs:70:9
|
||||
|
|
||||
LL | let parser: i32;
|
||||
| ^^^^^^
|
||||
|
||||
error: binding's name is too similar to existing binding
|
||||
--> $DIR/similar_names.rs:88:16
|
||||
--> $DIR/similar_names.rs:93:16
|
||||
|
|
||||
LL | bpple: sprang,
|
||||
| ^^^^^^
|
||||
|
|
||||
note: existing binding defined here
|
||||
--> $DIR/similar_names.rs:87:16
|
||||
--> $DIR/similar_names.rs:92:16
|
||||
|
|
||||
LL | apple: spring,
|
||||
| ^^^^^^
|
||||
|
@ -1,6 +1,7 @@
|
||||
// aux-build:proc_macro_suspicious_else_formatting.rs
|
||||
|
||||
#![warn(clippy::suspicious_else_formatting)]
|
||||
#![allow(clippy::if_same_then_else)]
|
||||
|
||||
extern crate proc_macro_suspicious_else_formatting;
|
||||
use proc_macro_suspicious_else_formatting::DeriveBadSpan;
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this looks like an `else {..}` but the `else` is missing
|
||||
--> $DIR/suspicious_else_formatting.rs:16:6
|
||||
--> $DIR/suspicious_else_formatting.rs:17:6
|
||||
|
|
||||
LL | } {
|
||||
| ^
|
||||
@ -8,7 +8,7 @@ LL | } {
|
||||
= note: to remove this lint, add the missing `else` or add a new line before the next block
|
||||
|
||||
error: this looks like an `else if` but the `else` is missing
|
||||
--> $DIR/suspicious_else_formatting.rs:20:6
|
||||
--> $DIR/suspicious_else_formatting.rs:21:6
|
||||
|
|
||||
LL | } if foo() {
|
||||
| ^
|
||||
@ -16,7 +16,7 @@ LL | } if foo() {
|
||||
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
|
||||
|
||||
error: this looks like an `else if` but the `else` is missing
|
||||
--> $DIR/suspicious_else_formatting.rs:27:10
|
||||
--> $DIR/suspicious_else_formatting.rs:28:10
|
||||
|
|
||||
LL | } if foo() {
|
||||
| ^
|
||||
@ -24,7 +24,7 @@ LL | } if foo() {
|
||||
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
|
||||
|
||||
error: this looks like an `else if` but the `else` is missing
|
||||
--> $DIR/suspicious_else_formatting.rs:35:10
|
||||
--> $DIR/suspicious_else_formatting.rs:36:10
|
||||
|
|
||||
LL | } if foo() {
|
||||
| ^
|
||||
@ -32,7 +32,7 @@ LL | } if foo() {
|
||||
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
|
||||
|
||||
error: this is an `else {..}` but the formatting might hide it
|
||||
--> $DIR/suspicious_else_formatting.rs:44:6
|
||||
--> $DIR/suspicious_else_formatting.rs:45:6
|
||||
|
|
||||
LL | } else
|
||||
| ______^
|
||||
@ -42,7 +42,7 @@ LL | | {
|
||||
= note: to remove this lint, remove the `else` or remove the new line between `else` and `{..}`
|
||||
|
||||
error: this is an `else if` but the formatting might hide it
|
||||
--> $DIR/suspicious_else_formatting.rs:56:6
|
||||
--> $DIR/suspicious_else_formatting.rs:57:6
|
||||
|
|
||||
LL | } else
|
||||
| ______^
|
||||
@ -52,7 +52,7 @@ LL | | if foo() { // the span of the above error should continue here
|
||||
= note: to remove this lint, remove the `else` or remove the new line between `else` and `if`
|
||||
|
||||
error: this is an `else if` but the formatting might hide it
|
||||
--> $DIR/suspicious_else_formatting.rs:61:6
|
||||
--> $DIR/suspicious_else_formatting.rs:62:6
|
||||
|
|
||||
LL | }
|
||||
| ______^
|
||||
@ -63,7 +63,7 @@ LL | | if foo() { // the span of the above error should continue here
|
||||
= note: to remove this lint, remove the `else` or remove the new line between `else` and `if`
|
||||
|
||||
error: this is an `else {..}` but the formatting might hide it
|
||||
--> $DIR/suspicious_else_formatting.rs:88:6
|
||||
--> $DIR/suspicious_else_formatting.rs:89:6
|
||||
|
|
||||
LL | }
|
||||
| ______^
|
||||
@ -75,7 +75,7 @@ LL | | {
|
||||
= note: to remove this lint, remove the `else` or remove the new line between `else` and `{..}`
|
||||
|
||||
error: this is an `else {..}` but the formatting might hide it
|
||||
--> $DIR/suspicious_else_formatting.rs:96:6
|
||||
--> $DIR/suspicious_else_formatting.rs:97:6
|
||||
|
|
||||
LL | }
|
||||
| ______^
|
||||
|
@ -1,4 +1,5 @@
|
||||
#![warn(clippy::suspicious_operation_groupings)]
|
||||
#![allow(clippy::eq_op)]
|
||||
|
||||
struct Vec3 {
|
||||
x: f64,
|
||||
@ -187,7 +188,7 @@ fn inside_fn_with_similar_expression(s1: &S, s2: &S, strict: bool) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
fn inside_an_if_statement(s1: &S, s2: &S) {
|
||||
fn inside_an_if_statement(s1: &mut S, s2: &S) {
|
||||
// There's no `s1.b`
|
||||
if s1.a < s2.a && s1.a < s2.b {
|
||||
s1.c = s2.c;
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:14:9
|
||||
--> $DIR/suspicious_operation_groupings.rs:15:9
|
||||
|
|
||||
LL | self.x == other.y && self.y == other.y && self.z == other.z
|
||||
| ^^^^^^^^^^^^^^^^^ help: did you mean: `self.x == other.x`
|
||||
@ -7,151 +7,151 @@ LL | self.x == other.y && self.y == other.y && self.z == other.z
|
||||
= note: `-D clippy::suspicious-operation-groupings` implied by `-D warnings`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:27:20
|
||||
--> $DIR/suspicious_operation_groupings.rs:28:20
|
||||
|
|
||||
LL | s1.a < s2.a && s1.a < s2.b
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b < s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:75:33
|
||||
--> $DIR/suspicious_operation_groupings.rs:76:33
|
||||
|
|
||||
LL | s1.a * s2.a + s1.b * s2.b + s1.c * s2.b + s1.d * s2.d
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:80:19
|
||||
--> $DIR/suspicious_operation_groupings.rs:81:19
|
||||
|
|
||||
LL | s1.a * s2.a + s1.b * s2.c + s1.c * s2.c
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:80:19
|
||||
--> $DIR/suspicious_operation_groupings.rs:81:19
|
||||
|
|
||||
LL | s1.a * s2.a + s1.b * s2.c + s1.c * s2.c
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:85:19
|
||||
--> $DIR/suspicious_operation_groupings.rs:86:19
|
||||
|
|
||||
LL | s1.a * s2.a + s2.b * s2.b + s1.c * s2.c
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:90:19
|
||||
--> $DIR/suspicious_operation_groupings.rs:91:19
|
||||
|
|
||||
LL | s1.a * s2.a + s1.b * s1.b + s1.c * s2.c
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:95:5
|
||||
--> $DIR/suspicious_operation_groupings.rs:96:5
|
||||
|
|
||||
LL | s1.a * s1.a + s1.b * s2.b + s1.c * s2.c
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.a * s2.a`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:100:33
|
||||
--> $DIR/suspicious_operation_groupings.rs:101:33
|
||||
|
|
||||
LL | s1.a * s2.a + s1.b * s2.b + s1.c * s1.c
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:113:20
|
||||
--> $DIR/suspicious_operation_groupings.rs:114:20
|
||||
|
|
||||
LL | (s1.a * s2.a + s1.b * s1.b)
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:118:34
|
||||
--> $DIR/suspicious_operation_groupings.rs:119:34
|
||||
|
|
||||
LL | (s1.a * s2.a + s1.b * s2.b + s1.c * s2.b + s1.d * s2.d)
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:123:38
|
||||
--> $DIR/suspicious_operation_groupings.rs:124:38
|
||||
|
|
||||
LL | (s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d)
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:128:39
|
||||
--> $DIR/suspicious_operation_groupings.rs:129:39
|
||||
|
|
||||
LL | ((s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d))
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:133:42
|
||||
--> $DIR/suspicious_operation_groupings.rs:134:42
|
||||
|
|
||||
LL | (((s1.a * s2.a) + (s1.b * s2.b)) + ((s1.c * s2.b) + (s1.d * s2.d)))
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:133:42
|
||||
--> $DIR/suspicious_operation_groupings.rs:134:42
|
||||
|
|
||||
LL | (((s1.a * s2.a) + (s1.b * s2.b)) + ((s1.c * s2.b) + (s1.d * s2.d)))
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:138:40
|
||||
--> $DIR/suspicious_operation_groupings.rs:139:40
|
||||
|
|
||||
LL | (((s1.a * s2.a) + (s1.b * s2.b) + (s1.c * s2.b)) + (s1.d * s2.d))
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:143:40
|
||||
--> $DIR/suspicious_operation_groupings.rs:144:40
|
||||
|
|
||||
LL | ((s1.a * s2.a) + ((s1.b * s2.b) + (s1.c * s2.b) + (s1.d * s2.d)))
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.c * s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:148:20
|
||||
--> $DIR/suspicious_operation_groupings.rs:149:20
|
||||
|
|
||||
LL | (s1.a * s2.a + s2.b * s2.b) / 2
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:153:35
|
||||
--> $DIR/suspicious_operation_groupings.rs:154:35
|
||||
|
|
||||
LL | i32::swap_bytes(s1.a * s2.a + s2.b * s2.b)
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b * s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:158:29
|
||||
--> $DIR/suspicious_operation_groupings.rs:159:29
|
||||
|
|
||||
LL | s1.a > 0 && s1.b > 0 && s1.d == s2.c && s1.d == s2.d
|
||||
| ^^^^^^^^^^^^ help: did you mean: `s1.c == s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:163:17
|
||||
--> $DIR/suspicious_operation_groupings.rs:164:17
|
||||
|
|
||||
LL | s1.a > 0 && s1.d == s2.c && s1.b > 0 && s1.d == s2.d
|
||||
| ^^^^^^^^^^^^ help: did you mean: `s1.c == s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:172:77
|
||||
--> $DIR/suspicious_operation_groupings.rs:173:77
|
||||
|
|
||||
LL | (n1.inner.0).0 == (n2.inner.0).0 && (n1.inner.1).0 == (n2.inner.1).0 && (n1.inner.2).0 == (n2.inner.1).0
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `(n1.inner.2).0 == (n2.inner.2).0`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:186:25
|
||||
--> $DIR/suspicious_operation_groupings.rs:187:25
|
||||
|
|
||||
LL | s1.a <= s2.a && s1.a <= s2.b
|
||||
| ^^^^^^^^^^^^ help: did you mean: `s1.b <= s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:192:23
|
||||
--> $DIR/suspicious_operation_groupings.rs:193:23
|
||||
|
|
||||
LL | if s1.a < s2.a && s1.a < s2.b {
|
||||
| ^^^^^^^^^^^ help: did you mean: `s1.b < s2.b`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:199:48
|
||||
--> $DIR/suspicious_operation_groupings.rs:200:48
|
||||
|
|
||||
LL | -(-(-s1.a * -s2.a) + (-(-s1.b * -s2.b) + -(-s1.c * -s2.b) + -(-s1.d * -s2.d)))
|
||||
| ^^^^^^^^^^^^^ help: did you mean: `-s1.c * -s2.c`
|
||||
|
||||
error: this sequence of operators looks suspiciously like a bug
|
||||
--> $DIR/suspicious_operation_groupings.rs:204:27
|
||||
--> $DIR/suspicious_operation_groupings.rs:205:27
|
||||
|
|
||||
LL | -(if -s1.a < -s2.a && -s1.a < -s2.b { s1.c } else { s2.a })
|
||||
| ^^^^^^^^^^^^^ help: did you mean: `-s1.b < -s2.b`
|
||||
|
Loading…
x
Reference in New Issue
Block a user