diff --git a/clippy_lints/src/asm_syntax.rs b/clippy_lints/src/asm_syntax.rs index 0322698f029..f419781dbc8 100644 --- a/clippy_lints/src/asm_syntax.rs +++ b/clippy_lints/src/asm_syntax.rs @@ -65,6 +65,7 @@ declare_clippy_lint! { /// ```rust,no_run /// # #![feature(asm)] /// # unsafe { let ptr = "".as_ptr(); + /// # use std::arch::asm; /// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr); /// # } /// ``` @@ -72,6 +73,7 @@ declare_clippy_lint! { /// ```rust,no_run /// # #![feature(asm)] /// # unsafe { let ptr = "".as_ptr(); + /// # use std::arch::asm; /// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax)); /// # } /// ``` @@ -102,6 +104,7 @@ declare_clippy_lint! { /// ```rust,no_run /// # #![feature(asm)] /// # unsafe { let ptr = "".as_ptr(); + /// # use std::arch::asm; /// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax)); /// # } /// ``` @@ -109,6 +112,7 @@ declare_clippy_lint! { /// ```rust,no_run /// # #![feature(asm)] /// # unsafe { let ptr = "".as_ptr(); + /// # use std::arch::asm; /// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr); /// # } /// ``` diff --git a/clippy_lints/src/bytecount.rs b/clippy_lints/src/bytecount.rs index 657c1f88c7d..92336a54e27 100644 --- a/clippy_lints/src/bytecount.rs +++ b/clippy_lints/src/bytecount.rs @@ -42,7 +42,7 @@ impl<'tcx> LateLintPass<'tcx> for ByteCount { fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) { if_chain! { if let ExprKind::MethodCall(count, _, [count_recv], _) = expr.kind; - if count.ident.name == sym!(count); + if count.ident.name == sym::count; if let ExprKind::MethodCall(filter, _, [filter_recv, filter_arg], _) = count_recv.kind; if filter.ident.name == sym!(filter); if let ExprKind::Closure(_, _, body_id, _, _) = filter_arg.kind; diff --git a/clippy_lints/src/future_not_send.rs b/clippy_lints/src/future_not_send.rs index fefdcfed42f..43911a313d5 100644 --- a/clippy_lints/src/future_not_send.rs +++ b/clippy_lints/src/future_not_send.rs @@ -68,8 +68,8 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend { let mut is_future = false; for &(p, _span) in preds { let p = p.subst(cx.tcx, subst); - if let Some(trait_ref) = p.to_opt_poly_trait_ref() { - if Some(trait_ref.value.def_id()) == cx.tcx.lang_items().future_trait() { + if let Some(trait_pred) = p.to_opt_poly_trait_pred() { + if Some(trait_pred.skip_binder().trait_ref.def_id) == cx.tcx.lang_items().future_trait() { is_future = true; break; } diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index c6b14ecac43..d1c7956a7a5 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -3,7 +3,6 @@ #![feature(box_patterns)] #![feature(drain_filter)] #![feature(in_band_lifetimes)] -#![feature(iter_zip)] #![feature(once_cell)] #![feature(rustc_private)] #![feature(stmt_expr_attributes)] diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index 385232f4d71..acac0887226 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -13,7 +13,6 @@ use clippy_utils::{ strip_pat_refs, }; use clippy_utils::{paths, search_same, SpanlessEq, SpanlessHash}; -use core::array; use core::iter::{once, ExactSizeIterator}; use if_chain::if_chain; use rustc_ast::ast::{Attribute, LitKind}; @@ -1314,7 +1313,7 @@ fn check_match_like_matches<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) return find_matches_sugg( cx, let_expr, - array::IntoIter::new([(&[][..], Some(let_pat), if_then, None), (&[][..], None, if_else, None)]), + IntoIterator::into_iter([(&[][..], Some(let_pat), if_then, None), (&[][..], None, if_else, None)]), expr, true, ); diff --git a/clippy_lints/src/methods/str_splitn.rs b/clippy_lints/src/methods/str_splitn.rs index 2595f734f11..e5fafdb075c 100644 --- a/clippy_lints/src/methods/str_splitn.rs +++ b/clippy_lints/src/methods/str_splitn.rs @@ -204,7 +204,7 @@ fn parse_iter_usage( match e.kind { ExprKind::Call( Expr { - kind: ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, _)), + kind: ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, ..)), .. }, _, diff --git a/clippy_lints/src/needless_late_init.rs b/clippy_lints/src/needless_late_init.rs index e0522f3fe0b..094a3f111ba 100644 --- a/clippy_lints/src/needless_late_init.rs +++ b/clippy_lints/src/needless_late_init.rs @@ -155,8 +155,14 @@ fn assignment_suggestions<'tcx>( } let suggestions = assignments - .into_iter() - .map(|assignment| Some((assignment.span, snippet_opt(cx, assignment.rhs_span)?))) + .iter() + .map(|assignment| Some((assignment.span.until(assignment.rhs_span), String::new()))) + .chain(assignments.iter().map(|assignment| { + Some(( + assignment.rhs_span.shrink_to_hi().with_hi(assignment.span.hi()), + String::new(), + )) + })) .collect::>>()?; let applicability = if suggestions.len() > 1 { diff --git a/clippy_lints/src/needless_question_mark.rs b/clippy_lints/src/needless_question_mark.rs index 1ffed6a0524..0e7ae43ce2d 100644 --- a/clippy_lints/src/needless_question_mark.rs +++ b/clippy_lints/src/needless_question_mark.rs @@ -105,7 +105,7 @@ fn check(cx: &LateContext<'_>, expr: &Expr<'_>) { }; if let ExprKind::Match(inner_expr_with_q, _, MatchSource::TryDesugar) = &arg.kind; if let ExprKind::Call(called, [inner_expr]) = &inner_expr_with_q.kind; - if let ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, _)) = &called.kind; + if let ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, ..)) = &called.kind; if expr.span.ctxt() == inner_expr.span.ctxt(); let expr_ty = cx.typeck_results().expr_ty(expr); let inner_ty = cx.typeck_results().expr_ty(inner_expr); diff --git a/clippy_lints/src/redundant_clone.rs b/clippy_lints/src/redundant_clone.rs index 1a2c86a7686..1cf349f8aa7 100644 --- a/clippy_lints/src/redundant_clone.rs +++ b/clippy_lints/src/redundant_clone.rs @@ -15,7 +15,7 @@ use rustc_middle::mir::{ Mutability, }; use rustc_middle::ty::{self, fold::TypeVisitor, Ty, TyCtxt}; -use rustc_mir_dataflow::{Analysis, AnalysisDomain, GenKill, GenKillAnalysis, ResultsCursor}; +use rustc_mir_dataflow::{Analysis, AnalysisDomain, CallReturnPlaces, GenKill, GenKillAnalysis, ResultsCursor}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::{BytePos, Span}; use rustc_span::sym; @@ -500,11 +500,9 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeStorageLive { fn call_return_effect( &self, - _in_out: &mut impl GenKill, + _trans: &mut impl GenKill, _block: mir::BasicBlock, - _func: &mir::Operand<'tcx>, - _args: &[mir::Operand<'tcx>], - _return_place: mir::Place<'tcx>, + _return_places: CallReturnPlaces<'_, 'tcx>, ) { // Nothing to do when a call returns successfully } diff --git a/clippy_lints/src/strings.rs b/clippy_lints/src/strings.rs index b03f4583365..73600a8a087 100644 --- a/clippy_lints/src/strings.rs +++ b/clippy_lints/src/strings.rs @@ -257,7 +257,7 @@ impl<'tcx> LateLintPass<'tcx> for StringLitAsBytes { if method_names[0] == sym!(as_bytes); // Check for slicer - if let ExprKind::Struct(QPath::LangItem(LangItem::Range, _), _, _) = right.kind; + if let ExprKind::Struct(QPath::LangItem(LangItem::Range, ..), _, _) = right.kind; then { let mut applicability = Applicability::MachineApplicable; diff --git a/clippy_lints/src/try_err.rs b/clippy_lints/src/try_err.rs index e0e7ec9a452..4da32c52e75 100644 --- a/clippy_lints/src/try_err.rs +++ b/clippy_lints/src/try_err.rs @@ -65,7 +65,7 @@ impl<'tcx> LateLintPass<'tcx> for TryErr { if let ExprKind::Match(match_arg, _, MatchSource::TryDesugar) = expr.kind; if let ExprKind::Call(match_fun, try_args) = match_arg.kind; if let ExprKind::Path(ref match_fun_path) = match_fun.kind; - if matches!(match_fun_path, QPath::LangItem(LangItem::TryTraitBranch, _)); + if matches!(match_fun_path, QPath::LangItem(LangItem::TryTraitBranch, ..)); if let Some(try_arg) = try_args.get(0); if let ExprKind::Call(err_fun, err_args) = try_arg.kind; if let Some(err_arg) = err_args.get(0); diff --git a/clippy_lints/src/unused_io_amount.rs b/clippy_lints/src/unused_io_amount.rs index d4b5c9770a2..111413e5193 100644 --- a/clippy_lints/src/unused_io_amount.rs +++ b/clippy_lints/src/unused_io_amount.rs @@ -49,7 +49,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedIoAmount { if let hir::ExprKind::Call(func, [ref arg_0, ..]) = res.kind { if matches!( func.kind, - hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::TryTraitBranch, _)) + hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::TryTraitBranch, ..)) ) { check_map_error(cx, arg_0, expr); } diff --git a/clippy_lints/src/utils/author.rs b/clippy_lints/src/utils/author.rs index d20bf341318..f186e1f05a0 100644 --- a/clippy_lints/src/utils/author.rs +++ b/clippy_lints/src/utils/author.rs @@ -260,7 +260,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> { } fn qpath(&self, qpath: &Binding<&QPath<'_>>) { - if let QPath::LangItem(lang_item, _) = *qpath.value { + if let QPath::LangItem(lang_item, ..) = *qpath.value { out!("if matches!({qpath}, QPath::LangItem(LangItem::{lang_item:?}, _));"); } else { out!("if match_qpath({qpath}, &[{}]);", path_to_string(qpath.value)); diff --git a/clippy_utils/src/higher.rs b/clippy_utils/src/higher.rs index 7297265d08c..fc32e49420e 100644 --- a/clippy_utils/src/higher.rs +++ b/clippy_utils/src/higher.rs @@ -218,7 +218,7 @@ impl<'a> Range<'a> { hir::ExprKind::Call(path, args) if matches!( path.kind, - hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::RangeInclusiveNew, _)) + hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::RangeInclusiveNew, ..)) ) => { Some(Range { @@ -228,27 +228,27 @@ impl<'a> Range<'a> { }) }, hir::ExprKind::Struct(path, fields, None) => match &path { - hir::QPath::LangItem(hir::LangItem::RangeFull, _) => Some(Range { + hir::QPath::LangItem(hir::LangItem::RangeFull, ..) => Some(Range { start: None, end: None, limits: ast::RangeLimits::HalfOpen, }), - hir::QPath::LangItem(hir::LangItem::RangeFrom, _) => Some(Range { + hir::QPath::LangItem(hir::LangItem::RangeFrom, ..) => Some(Range { start: Some(get_field("start", fields)?), end: None, limits: ast::RangeLimits::HalfOpen, }), - hir::QPath::LangItem(hir::LangItem::Range, _) => Some(Range { + hir::QPath::LangItem(hir::LangItem::Range, ..) => Some(Range { start: Some(get_field("start", fields)?), end: Some(get_field("end", fields)?), limits: ast::RangeLimits::HalfOpen, }), - hir::QPath::LangItem(hir::LangItem::RangeToInclusive, _) => Some(Range { + hir::QPath::LangItem(hir::LangItem::RangeToInclusive, ..) => Some(Range { start: None, end: Some(get_field("end", fields)?), limits: ast::RangeLimits::Closed, }), - hir::QPath::LangItem(hir::LangItem::RangeTo, _) => Some(Range { + hir::QPath::LangItem(hir::LangItem::RangeTo, ..) => Some(Range { start: None, end: Some(get_field("end", fields)?), limits: ast::RangeLimits::HalfOpen, diff --git a/clippy_utils/src/hir_utils.rs b/clippy_utils/src/hir_utils.rs index c1eaa5c5185..b8e53e47ed9 100644 --- a/clippy_utils/src/hir_utils.rs +++ b/clippy_utils/src/hir_utils.rs @@ -348,7 +348,7 @@ impl HirEqInterExpr<'_, '_, '_> { (&QPath::TypeRelative(lty, lseg), &QPath::TypeRelative(rty, rseg)) => { self.eq_ty(lty, rty) && self.eq_path_segment(lseg, rseg) }, - (&QPath::LangItem(llang_item, _), &QPath::LangItem(rlang_item, _)) => llang_item == rlang_item, + (&QPath::LangItem(llang_item, ..), &QPath::LangItem(rlang_item, ..)) => llang_item == rlang_item, _ => false, } } diff --git a/clippy_utils/src/lib.rs b/clippy_utils/src/lib.rs index 950cafbe9eb..d384c5a069e 100644 --- a/clippy_utils/src/lib.rs +++ b/clippy_utils/src/lib.rs @@ -1,6 +1,5 @@ #![feature(box_patterns)] #![feature(in_band_lifetimes)] -#![feature(iter_zip)] #![feature(let_else)] #![feature(rustc_private)] #![feature(control_flow_enum)] diff --git a/rust-toolchain b/rust-toolchain index 27969b0d655..3a5dfa6a8c7 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2021-12-02" +channel = "nightly-2021-12-17" components = ["cargo", "llvm-tools-preview", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"] diff --git a/tests/ui/asm_syntax.rs b/tests/ui/asm_syntax.rs index 4a62f6f2909..0220bf3331f 100644 --- a/tests/ui/asm_syntax.rs +++ b/tests/ui/asm_syntax.rs @@ -1,11 +1,10 @@ // only-x86_64 // ignore-aarch64 -#![feature(asm)] - #[warn(clippy::inline_asm_x86_intel_syntax)] mod warn_intel { pub(super) unsafe fn use_asm() { + use std::arch::asm; asm!(""); asm!("", options()); asm!("", options(nostack)); @@ -17,6 +16,7 @@ mod warn_intel { #[warn(clippy::inline_asm_x86_att_syntax)] mod warn_att { pub(super) unsafe fn use_asm() { + use std::arch::asm; asm!(""); asm!("", options()); asm!("", options(nostack)); diff --git a/tests/ui/asm_syntax.stderr b/tests/ui/asm_syntax.stderr index 409f4db76bc..e9b150121aa 100644 --- a/tests/ui/asm_syntax.stderr +++ b/tests/ui/asm_syntax.stderr @@ -1,5 +1,5 @@ error: Intel x86 assembly syntax used - --> $DIR/asm_syntax.rs:9:9 + --> $DIR/asm_syntax.rs:8:9 | LL | asm!(""); | ^^^^^^^^ @@ -8,7 +8,7 @@ LL | asm!(""); = help: use AT&T x86 assembly syntax error: Intel x86 assembly syntax used - --> $DIR/asm_syntax.rs:10:9 + --> $DIR/asm_syntax.rs:9:9 | LL | asm!("", options()); | ^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ LL | asm!("", options()); = help: use AT&T x86 assembly syntax error: Intel x86 assembly syntax used - --> $DIR/asm_syntax.rs:11:9 + --> $DIR/asm_syntax.rs:10:9 | LL | asm!("", options(nostack)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/crashes/ice-6250.stderr b/tests/ui/crashes/ice-6250.stderr index 0d7713aa9a2..7ffbd7a64b3 100644 --- a/tests/ui/crashes/ice-6250.stderr +++ b/tests/ui/crashes/ice-6250.stderr @@ -1,14 +1,3 @@ -error[E0658]: destructuring assignments are unstable - --> $DIR/ice-6250.rs:12:25 - | -LL | Some(reference) = cache.data.get(key) { - | --------------- ^ - | | - | cannot assign to this expression - | - = note: see issue #71126 for more information - = help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable - error[E0601]: `main` function not found in crate `ice_6250` --> $DIR/ice-6250.rs:4:1 | @@ -41,7 +30,7 @@ error[E0308]: mismatched types LL | Some(reference) = cache.data.get(key) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `()` -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0308, E0601, E0658. +Some errors have detailed explanations: E0308, E0601. For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/entry.fixed b/tests/ui/entry.fixed index 8a36ec833d7..e43635abcd1 100644 --- a/tests/ui/entry.fixed +++ b/tests/ui/entry.fixed @@ -2,8 +2,8 @@ #![allow(unused, clippy::needless_pass_by_value, clippy::collapsible_if)] #![warn(clippy::map_entry)] -#![feature(asm)] +use std::arch::asm; use std::collections::HashMap; use std::hash::Hash; diff --git a/tests/ui/entry.rs b/tests/ui/entry.rs index d972a201ad7..d999b3b7dc8 100644 --- a/tests/ui/entry.rs +++ b/tests/ui/entry.rs @@ -2,8 +2,8 @@ #![allow(unused, clippy::needless_pass_by_value, clippy::collapsible_if)] #![warn(clippy::map_entry)] -#![feature(asm)] +use std::arch::asm; use std::collections::HashMap; use std::hash::Hash; diff --git a/tests/ui/future_not_send.stderr b/tests/ui/future_not_send.stderr index 3cc05e2fdbe..a9f2ad36d0a 100644 --- a/tests/ui/future_not_send.stderr +++ b/tests/ui/future_not_send.stderr @@ -6,22 +6,22 @@ LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell) -> bool { | = note: `-D clippy::future-not-send` implied by `-D warnings` note: future is not `Send` as this value is used across an await - --> $DIR/future_not_send.rs:8:5 + --> $DIR/future_not_send.rs:8:19 | LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell) -> bool { | -- has type `std::rc::Rc<[u8]>` which is not `Send` LL | async { true }.await - | ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `rc` maybe used later + | ^^^^^^ await occurs here, with `rc` maybe used later LL | } | - `rc` is later dropped here = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send` note: future is not `Send` as this value is used across an await - --> $DIR/future_not_send.rs:8:5 + --> $DIR/future_not_send.rs:8:19 | LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell) -> bool { | ---- has type `&std::cell::Cell` which is not `Send` LL | async { true }.await - | ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `cell` maybe used later + | ^^^^^^ await occurs here, with `cell` maybe used later LL | } | - `cell` is later dropped here = note: `std::cell::Cell` doesn't implement `std::marker::Sync` @@ -33,12 +33,12 @@ LL | pub async fn public_future(rc: Rc<[u8]>) { | ^ future returned by `public_future` is not `Send` | note: future is not `Send` as this value is used across an await - --> $DIR/future_not_send.rs:12:5 + --> $DIR/future_not_send.rs:12:19 | LL | pub async fn public_future(rc: Rc<[u8]>) { | -- has type `std::rc::Rc<[u8]>` which is not `Send` LL | async { true }.await; - | ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `rc` maybe used later + | ^^^^^^ await occurs here, with `rc` maybe used later LL | } | - `rc` is later dropped here = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send` @@ -82,12 +82,12 @@ LL | async fn private_future(&self) -> usize { | ^^^^^ future returned by `private_future` is not `Send` | note: future is not `Send` as this value is used across an await - --> $DIR/future_not_send.rs:35:9 + --> $DIR/future_not_send.rs:35:23 | LL | async fn private_future(&self) -> usize { | ----- has type `&Dummy` which is not `Send` LL | async { true }.await; - | ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `&self` maybe used later + | ^^^^^^ await occurs here, with `&self` maybe used later LL | self.rc.len() LL | } | - `&self` is later dropped here @@ -100,12 +100,12 @@ LL | pub async fn public_future(&self) { | ^ future returned by `public_future` is not `Send` | note: future is not `Send` as this value is used across an await - --> $DIR/future_not_send.rs:40:9 + --> $DIR/future_not_send.rs:40:30 | LL | pub async fn public_future(&self) { | ----- has type `&Dummy` which is not `Send` LL | self.private_future().await; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ await occurs here, with `&self` maybe used later + | ^^^^^^ await occurs here, with `&self` maybe used later LL | } | - `&self` is later dropped here = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync` @@ -117,12 +117,12 @@ LL | async fn generic_future(t: T) -> T | ^ future returned by `generic_future` is not `Send` | note: future is not `Send` as this value is used across an await - --> $DIR/future_not_send.rs:54:5 + --> $DIR/future_not_send.rs:54:19 | LL | let rt = &t; | -- has type `&T` which is not `Send` LL | async { true }.await; - | ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `rt` maybe used later + | ^^^^^^ await occurs here, with `rt` maybe used later LL | t LL | } | - `rt` is later dropped here diff --git a/tests/ui/missing-doc.rs b/tests/ui/missing-doc.rs index 148531c285d..6e2e710e21c 100644 --- a/tests/ui/missing-doc.rs +++ b/tests/ui/missing-doc.rs @@ -2,10 +2,11 @@ // When denying at the crate level, be sure to not get random warnings from the // injected intrinsics by the compiler. #![allow(dead_code)] -#![feature(global_asm)] //! Some garbage docs for the crate here #![doc = "More garbage"] +use std::arch::global_asm; + type Typedef = String; pub type PubTypedef = String; diff --git a/tests/ui/missing-doc.stderr b/tests/ui/missing-doc.stderr index 7a3a448c9d6..a876dc078eb 100644 --- a/tests/ui/missing-doc.stderr +++ b/tests/ui/missing-doc.stderr @@ -1,5 +1,5 @@ error: missing documentation for a type alias - --> $DIR/missing-doc.rs:9:1 + --> $DIR/missing-doc.rs:10:1 | LL | type Typedef = String; | ^^^^^^^^^^^^^^^^^^^^^^ @@ -7,37 +7,37 @@ LL | type Typedef = String; = note: `-D clippy::missing-docs-in-private-items` implied by `-D warnings` error: missing documentation for a type alias - --> $DIR/missing-doc.rs:10:1 + --> $DIR/missing-doc.rs:11:1 | LL | pub type PubTypedef = String; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a module - --> $DIR/missing-doc.rs:12:1 + --> $DIR/missing-doc.rs:13:1 | LL | mod module_no_dox {} | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a module - --> $DIR/missing-doc.rs:13:1 + --> $DIR/missing-doc.rs:14:1 | LL | pub mod pub_module_no_dox {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/missing-doc.rs:17:1 + --> $DIR/missing-doc.rs:18:1 | LL | pub fn foo2() {} | ^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/missing-doc.rs:18:1 + --> $DIR/missing-doc.rs:19:1 | LL | fn foo3() {} | ^^^^^^^^^^^^ error: missing documentation for an enum - --> $DIR/missing-doc.rs:32:1 + --> $DIR/missing-doc.rs:33:1 | LL | / enum Baz { LL | | BazA { a: isize, b: isize }, @@ -46,31 +46,31 @@ LL | | } | |_^ error: missing documentation for a variant - --> $DIR/missing-doc.rs:33:5 + --> $DIR/missing-doc.rs:34:5 | LL | BazA { a: isize, b: isize }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:33:12 + --> $DIR/missing-doc.rs:34:12 | LL | BazA { a: isize, b: isize }, | ^^^^^^^^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:33:22 + --> $DIR/missing-doc.rs:34:22 | LL | BazA { a: isize, b: isize }, | ^^^^^^^^ error: missing documentation for a variant - --> $DIR/missing-doc.rs:34:5 + --> $DIR/missing-doc.rs:35:5 | LL | BarB, | ^^^^ error: missing documentation for an enum - --> $DIR/missing-doc.rs:37:1 + --> $DIR/missing-doc.rs:38:1 | LL | / pub enum PubBaz { LL | | PubBazA { a: isize }, @@ -78,43 +78,43 @@ LL | | } | |_^ error: missing documentation for a variant - --> $DIR/missing-doc.rs:38:5 + --> $DIR/missing-doc.rs:39:5 | LL | PubBazA { a: isize }, | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a struct field - --> $DIR/missing-doc.rs:38:15 + --> $DIR/missing-doc.rs:39:15 | LL | PubBazA { a: isize }, | ^^^^^^^^ error: missing documentation for a constant - --> $DIR/missing-doc.rs:58:1 + --> $DIR/missing-doc.rs:59:1 | LL | const FOO: u32 = 0; | ^^^^^^^^^^^^^^^^^^^ error: missing documentation for a constant - --> $DIR/missing-doc.rs:65:1 + --> $DIR/missing-doc.rs:66:1 | LL | pub const FOO4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a static - --> $DIR/missing-doc.rs:67:1 + --> $DIR/missing-doc.rs:68:1 | LL | static BAR: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a static - --> $DIR/missing-doc.rs:74:1 + --> $DIR/missing-doc.rs:75:1 | LL | pub static BAR4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a module - --> $DIR/missing-doc.rs:76:1 + --> $DIR/missing-doc.rs:77:1 | LL | / mod internal_impl { LL | | /// dox @@ -126,31 +126,31 @@ LL | | } | |_^ error: missing documentation for a function - --> $DIR/missing-doc.rs:79:5 + --> $DIR/missing-doc.rs:80:5 | LL | pub fn undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/missing-doc.rs:80:5 + --> $DIR/missing-doc.rs:81:5 | LL | pub fn undocumented2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/missing-doc.rs:81:5 + --> $DIR/missing-doc.rs:82:5 | LL | fn undocumented3() {} | ^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/missing-doc.rs:86:9 + --> $DIR/missing-doc.rs:87:9 | LL | pub fn also_undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/missing-doc.rs:87:9 + --> $DIR/missing-doc.rs:88:9 | LL | fn also_undocumented2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/needless_late_init.rs b/tests/ui/needless_late_init.rs index 6fdb4cc566f..89e012c066f 100644 --- a/tests/ui/needless_late_init.rs +++ b/tests/ui/needless_late_init.rs @@ -39,6 +39,19 @@ fn main() { e = format!("{}", c); } + let f; + match 1 { + 1 => f = "three", + _ => return, + }; // has semi + + let g: usize; + if true { + g = 5; + } else { + panic!(); + } + println!("{}", a); } diff --git a/tests/ui/needless_late_init.stderr b/tests/ui/needless_late_init.stderr index cbb7538c63b..ef79e635d2a 100644 --- a/tests/ui/needless_late_init.stderr +++ b/tests/ui/needless_late_init.stderr @@ -105,7 +105,43 @@ LL | }; | + error: unneeded late initalization - --> $DIR/needless_late_init.rs:50:5 + --> $DIR/needless_late_init.rs:42:5 + | +LL | let f; + | ^^^^^^ + | +help: declare `f` here + | +LL | let f = match 1 { + | +++++++ +help: remove the assignments from the `match` arms + | +LL - 1 => f = "three", +LL + 1 => "three", + | + +error: unneeded late initalization + --> $DIR/needless_late_init.rs:48:5 + | +LL | let g: usize; + | ^^^^^^^^^^^^^ + | +help: declare `g` here + | +LL | let g: usize = if true { + | ++++++++++++++ +help: remove the assignments from the branches + | +LL - g = 5; +LL + 5 + | +help: add a semicolon after the `if` expression + | +LL | }; + | + + +error: unneeded late initalization + --> $DIR/needless_late_init.rs:63:5 | LL | let a; | ^^^^^^ @@ -126,7 +162,7 @@ LL | }; | + error: unneeded late initalization - --> $DIR/needless_late_init.rs:67:5 + --> $DIR/needless_late_init.rs:80:5 | LL | let a; | ^^^^^^ @@ -146,5 +182,5 @@ help: add a semicolon after the `match` expression LL | }; | + -error: aborting due to 7 previous errors +error: aborting due to 9 previous errors diff --git a/tests/ui/needless_late_init_fixable.fixed b/tests/ui/needless_late_init_fixable.fixed index 32d5d04fde4..b516f9d86b7 100644 --- a/tests/ui/needless_late_init_fixable.fixed +++ b/tests/ui/needless_late_init_fixable.fixed @@ -19,19 +19,6 @@ fn main() { e = 2; - let f = match 1 { - 1 => "three", - _ => return, - }; // has semi - - - let g: usize = if true { - 5 - } else { - panic!(); - }; - - let h = format!("{}", e); println!("{}", a); diff --git a/tests/ui/needless_late_init_fixable.rs b/tests/ui/needless_late_init_fixable.rs index 6bc85f68632..75a4bc916de 100644 --- a/tests/ui/needless_late_init_fixable.rs +++ b/tests/ui/needless_late_init_fixable.rs @@ -18,19 +18,6 @@ fn main() { e = 1; e = 2; - let f; - match 1 { - 1 => f = "three", - _ => return, - }; // has semi - - let g: usize; - if true { - g = 5; - } else { - panic!(); - } - let h; h = format!("{}", e); diff --git a/tests/ui/needless_late_init_fixable.stderr b/tests/ui/needless_late_init_fixable.stderr index a0ce4f812f4..3f3d4f5286b 100644 --- a/tests/ui/needless_late_init_fixable.stderr +++ b/tests/ui/needless_late_init_fixable.stderr @@ -57,40 +57,6 @@ LL | let mut e = 1; error: unneeded late initalization --> $DIR/needless_late_init_fixable.rs:21:5 | -LL | let f; - | ^^^^^^ - | -help: declare `f` here - | -LL | let f = match 1 { - | +++++++ -help: remove the assignments from the `match` arms - | -LL | 1 => "three", - | ~~~~~~~ - -error: unneeded late initalization - --> $DIR/needless_late_init_fixable.rs:27:5 - | -LL | let g: usize; - | ^^^^^^^^^^^^^ - | -help: declare `g` here - | -LL | let g: usize = if true { - | ++++++++++++++ -help: remove the assignments from the branches - | -LL | 5 - | -help: add a semicolon after the `if` expression - | -LL | }; - | + - -error: unneeded late initalization - --> $DIR/needless_late_init_fixable.rs:34:5 - | LL | let h; | ^^^^^^ | @@ -99,5 +65,5 @@ help: declare `h` here LL | let h = format!("{}", e); | ~~~~~ -error: aborting due to 8 previous errors +error: aborting due to 6 previous errors diff --git a/tests/ui/trailing_empty_array.rs b/tests/ui/trailing_empty_array.rs index 501c9eb7651..c39b0bcaf22 100644 --- a/tests/ui/trailing_empty_array.rs +++ b/tests/ui/trailing_empty_array.rs @@ -1,5 +1,4 @@ #![warn(clippy::trailing_empty_array)] -#![feature(const_generics_defaults)] // Do lint: diff --git a/tests/ui/trailing_empty_array.stderr b/tests/ui/trailing_empty_array.stderr index d88aa0504b5..9e2bd31d9fa 100644 --- a/tests/ui/trailing_empty_array.stderr +++ b/tests/ui/trailing_empty_array.stderr @@ -1,5 +1,5 @@ error: trailing zero-sized array in a struct which is not marked with a `repr` attribute - --> $DIR/trailing_empty_array.rs:6:1 + --> $DIR/trailing_empty_array.rs:5:1 | LL | / struct RarelyUseful { LL | | field: i32, @@ -11,7 +11,7 @@ LL | | } = help: consider annotating `RarelyUseful` with `#[repr(C)]` or another `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute - --> $DIR/trailing_empty_array.rs:11:1 + --> $DIR/trailing_empty_array.rs:10:1 | LL | / struct OnlyField { LL | | first_and_last: [usize; 0], @@ -21,7 +21,7 @@ LL | | } = help: consider annotating `OnlyField` with `#[repr(C)]` or another `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute - --> $DIR/trailing_empty_array.rs:15:1 + --> $DIR/trailing_empty_array.rs:14:1 | LL | / struct GenericArrayType { LL | | field: i32, @@ -32,7 +32,7 @@ LL | | } = help: consider annotating `GenericArrayType` with `#[repr(C)]` or another `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute - --> $DIR/trailing_empty_array.rs:21:1 + --> $DIR/trailing_empty_array.rs:20:1 | LL | / struct OnlyAnotherAttribute { LL | | field: i32, @@ -43,7 +43,7 @@ LL | | } = help: consider annotating `OnlyAnotherAttribute` with `#[repr(C)]` or another `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute - --> $DIR/trailing_empty_array.rs:27:1 + --> $DIR/trailing_empty_array.rs:26:1 | LL | / struct OnlyADeriveAttribute { LL | | field: i32, @@ -54,7 +54,7 @@ LL | | } = help: consider annotating `OnlyADeriveAttribute` with `#[repr(C)]` or another `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute - --> $DIR/trailing_empty_array.rs:33:1 + --> $DIR/trailing_empty_array.rs:32:1 | LL | / struct ZeroSizedWithConst { LL | | field: i32, @@ -65,7 +65,7 @@ LL | | } = help: consider annotating `ZeroSizedWithConst` with `#[repr(C)]` or another `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute - --> $DIR/trailing_empty_array.rs:42:1 + --> $DIR/trailing_empty_array.rs:41:1 | LL | / struct ZeroSizedWithConstFunction { LL | | field: i32, @@ -76,7 +76,7 @@ LL | | } = help: consider annotating `ZeroSizedWithConstFunction` with `#[repr(C)]` or another `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute - --> $DIR/trailing_empty_array.rs:50:1 + --> $DIR/trailing_empty_array.rs:49:1 | LL | / struct ZeroSizedWithConstFunction2 { LL | | field: i32, @@ -87,7 +87,7 @@ LL | | } = help: consider annotating `ZeroSizedWithConstFunction2` with `#[repr(C)]` or another `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute - --> $DIR/trailing_empty_array.rs:55:1 + --> $DIR/trailing_empty_array.rs:54:1 | LL | struct ZeroSizedArrayWrapper([usize; 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -95,7 +95,7 @@ LL | struct ZeroSizedArrayWrapper([usize; 0]); = help: consider annotating `ZeroSizedArrayWrapper` with `#[repr(C)]` or another `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute - --> $DIR/trailing_empty_array.rs:57:1 + --> $DIR/trailing_empty_array.rs:56:1 | LL | struct TupleStruct(i32, [usize; 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ LL | struct TupleStruct(i32, [usize; 0]); = help: consider annotating `TupleStruct` with `#[repr(C)]` or another `repr` attribute error: trailing zero-sized array in a struct which is not marked with a `repr` attribute - --> $DIR/trailing_empty_array.rs:59:1 + --> $DIR/trailing_empty_array.rs:58:1 | LL | / struct LotsOfFields { LL | | f1: u32,