diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs index b28f8ce1d8b3a..d627afd7c58de 100644 --- a/compiler/rustc_borrowck/src/region_infer/mod.rs +++ b/compiler/rustc_borrowck/src/region_infer/mod.rs @@ -1751,7 +1751,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { .map(|&(category, span)| BlameConstraint { category, from_closure: true, - span: span, + span, variance_info: constraint.variance_info, }) .unwrap_or(BlameConstraint { diff --git a/compiler/rustc_codegen_llvm/src/type_of.rs b/compiler/rustc_codegen_llvm/src/type_of.rs index 3e39bf3e995a2..e7c3edcc0528f 100644 --- a/compiler/rustc_codegen_llvm/src/type_of.rs +++ b/compiler/rustc_codegen_llvm/src/type_of.rs @@ -268,10 +268,9 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> { }; debug!("--> mapped {:#?} to llty={:?}", self, llty); - cx.type_lowering.borrow_mut().insert( - (self.ty, variant_index), - TypeLowering { lltype: llty, field_remapping: field_remapping }, - ); + cx.type_lowering + .borrow_mut() + .insert((self.ty, variant_index), TypeLowering { lltype: llty, field_remapping }); if let Some((llty, layout)) = defer { let (llfields, packed, new_field_remapping) = struct_llfields(cx, layout); diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs index 0da6d8169bd3a..b1ca03939e45f 100644 --- a/compiler/rustc_const_eval/src/interpret/place.rs +++ b/compiler/rustc_const_eval/src/interpret/place.rs @@ -447,7 +447,7 @@ where let actual_to = if from_end { if from.checked_add(to).map_or(true, |to| to > len) { // This can only be reached in ConstProp and non-rustc-MIR. - throw_ub!(BoundsCheckFailed { len: len, index: from.saturating_add(to) }); + throw_ub!(BoundsCheckFailed { len, index: from.saturating_add(to) }); } len.checked_sub(to).unwrap() } else { diff --git a/compiler/rustc_graphviz/src/lib.rs b/compiler/rustc_graphviz/src/lib.rs index 27390fd2e4d91..f7036a29976ca 100644 --- a/compiler/rustc_graphviz/src/lib.rs +++ b/compiler/rustc_graphviz/src/lib.rs @@ -154,7 +154,7 @@ //! pub fn render_to(output: &mut W) { //! let nodes = vec!["{x,y}","{x}","{y}","{}"]; //! let edges = vec![(0,1), (0,2), (1,3), (2,3)]; -//! let graph = Graph { nodes: nodes, edges: edges }; +//! let graph = Graph { nodes, edges }; //! //! dot::render(&graph, output).unwrap() //! } @@ -216,7 +216,7 @@ //! pub fn render_to(output: &mut W) { //! let nodes = vec!["{x,y}","{x}","{y}","{}"]; //! let edges = vec![(0,1), (0,2), (1,3), (2,3)]; -//! let graph = Graph { nodes: nodes, edges: edges }; +//! let graph = Graph { nodes, edges }; //! //! dot::render(&graph, output).unwrap() //! } diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index ef4bda666ba06..49853d097e3e5 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -57,6 +57,7 @@ mod non_fmt_panic; mod nonstandard_style; mod noop_method_call; mod passes; +mod redundant_field_initializers; mod redundant_semicolon; mod traits; mod types; @@ -83,6 +84,7 @@ use non_ascii_idents::*; use non_fmt_panic::NonPanicFmt; use nonstandard_style::*; use noop_method_call::*; +use redundant_field_initializers::*; use redundant_semicolon::*; use traits::*; use types::*; @@ -129,6 +131,7 @@ macro_rules! early_lint_passes { WhileTrue: WhileTrue, NonAsciiIdents: NonAsciiIdents, IncompleteFeatures: IncompleteFeatures, + RedundantFieldInitializers: RedundantFieldInitializers, RedundantSemicolons: RedundantSemicolons, UnusedDocComment: UnusedDocComment, ] diff --git a/compiler/rustc_lint/src/redundant_field_initializers.rs b/compiler/rustc_lint/src/redundant_field_initializers.rs new file mode 100644 index 0000000000000..77cd894da5942 --- /dev/null +++ b/compiler/rustc_lint/src/redundant_field_initializers.rs @@ -0,0 +1,67 @@ +use crate::{EarlyContext, EarlyLintPass, LintContext}; +use rustc_ast as ast; +use rustc_errors::Applicability; +use rustc_span::source_map::ExpnKind; + +declare_lint! { + /// The `redundant_field_initializers` lint checks for fields in struct literals + /// where shorthands could be used. + /// + /// ### Example + /// + /// ```rust + /// let bar: u8 = 123; + /// + /// struct Foo { + /// bar: u8, + /// } + /// + /// let foo = Foo { bar: bar }; + /// ``` + /// + /// {{produces}} + /// + /// ### Explanation + /// + /// If the field and variable names are the same, + /// the field name is redundant. + pub REDUNDANT_FIELD_INITIALIZERS, + Warn, + "checks for fields in struct literals where shorthands could be used" +} + +declare_lint_pass!(RedundantFieldInitializers => [REDUNDANT_FIELD_INITIALIZERS]); + +impl EarlyLintPass for RedundantFieldInitializers { + fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr) { + if let ExpnKind::Macro(..) = expr.span.ctxt().outer_expn_data().kind { + // Do not lint on macro output. + return; + } + + if let ast::ExprKind::Struct(ref se) = expr.kind { + for field in &se.fields { + if field.is_shorthand { + continue; + } + if let ast::ExprKind::Path(None, path) = &field.expr.kind { + if path.segments.len() == 1 + && path.segments[0].ident == field.ident + && path.segments[0].args.is_none() + { + cx.struct_span_lint(REDUNDANT_FIELD_INITIALIZERS, field.span, |lint| { + lint.build("redundant field names in struct initialization") + .span_suggestion( + field.span, + "replace it with", + field.ident.to_string(), + Applicability::MachineApplicable, + ) + .emit(); + }); + } + } + } + } + } +} diff --git a/compiler/rustc_middle/src/hir/map/collector.rs b/compiler/rustc_middle/src/hir/map/collector.rs index 082948eba416d..4e2e4330d878b 100644 --- a/compiler/rustc_middle/src/hir/map/collector.rs +++ b/compiler/rustc_middle/src/hir/map/collector.rs @@ -141,7 +141,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> { insert_vec_map( &mut nodes.nodes, hir_id.local_id, - ParentedNode { parent: self.parent_node.local_id, node: node }, + ParentedNode { parent: self.parent_node.local_id, node }, ); } diff --git a/compiler/rustc_mir_build/src/build/expr/as_constant.rs b/compiler/rustc_mir_build/src/build/expr/as_constant.rs index 5e305ebba2ff4..fa38f31041a87 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_constant.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_constant.rs @@ -30,7 +30,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { Constant { span, user_ty: None, literal: literal.into() } } ExprKind::ConstBlock { value } => { - Constant { span: span, user_ty: None, literal: value.into() } + Constant { span, user_ty: None, literal: value.into() } } _ => span_bug!(span, "expression is not a valid constant {:?}", kind), } diff --git a/compiler/rustc_mir_build/src/thir/cx/expr.rs b/compiler/rustc_mir_build/src/thir/cx/expr.rs index 66005be05df75..a9d82cd8547a6 100644 --- a/compiler/rustc_mir_build/src/thir/cx/expr.rs +++ b/compiler/rustc_mir_build/src/thir/cx/expr.rs @@ -704,8 +704,7 @@ impl<'tcx> Cx<'tcx> { ty: var_ty, }; let lhs = self.thir.exprs.push(mk_const(self.tcx().mk_const(lhs))); - let bin = - ExprKind::Binary { op: BinOp::Add, lhs: lhs, rhs: offset }; + let bin = ExprKind::Binary { op: BinOp::Add, lhs, rhs: offset }; self.thir.exprs.push(Expr { temp_lifetime, ty: var_ty, @@ -719,7 +718,7 @@ impl<'tcx> Cx<'tcx> { self.mirror_expr(source) }; - ExprKind::Cast { source: source } + ExprKind::Cast { source } }; if let Some(user_ty) = user_ty { diff --git a/compiler/rustc_target/src/spec/aarch64_apple_ios_sim.rs b/compiler/rustc_target/src/spec/aarch64_apple_ios_sim.rs index 07b3453218fee..8356051fcab59 100644 --- a/compiler/rustc_target/src/spec/aarch64_apple_ios_sim.rs +++ b/compiler/rustc_target/src/spec/aarch64_apple_ios_sim.rs @@ -12,7 +12,7 @@ pub fn target() -> Target { let llvm_target = super::apple_base::ios_sim_llvm_target(arch); Target { - llvm_target: llvm_target, + llvm_target, pointer_width: 64, data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(), arch: "aarch64".to_string(), diff --git a/compiler/rustc_typeck/src/check/upvar.rs b/compiler/rustc_typeck/src/check/upvar.rs index 53b99a14f379d..1e1c8ae64d0bf 100644 --- a/compiler/rustc_typeck/src/check/upvar.rs +++ b/compiler/rustc_typeck/src/check/upvar.rs @@ -1548,8 +1548,9 @@ fn apply_capture_kind_on_capture_ty( ) -> Ty<'tcx> { match capture_kind { ty::UpvarCapture::ByValue(_) => ty, - ty::UpvarCapture::ByRef(borrow) => tcx - .mk_ref(borrow.region, ty::TypeAndMut { ty: ty, mutbl: borrow.kind.to_mutbl_lossy() }), + ty::UpvarCapture::ByRef(borrow) => { + tcx.mk_ref(borrow.region, ty::TypeAndMut { ty, mutbl: borrow.kind.to_mutbl_lossy() }) + } } } diff --git a/library/alloc/tests/slice.rs b/library/alloc/tests/slice.rs index 13b8c059e37ae..d4581d4719965 100644 --- a/library/alloc/tests/slice.rs +++ b/library/alloc/tests/slice.rs @@ -1802,7 +1802,7 @@ fn panic_safe() { let mut input = (0..len) .map(|id| DropCounter { x: rng.next_u32() % modulus, - id: id, + id, version: Cell::new(0), }) .collect::>(); diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 61f6b4e01c18c..a73f909096e43 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -296,7 +296,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> { ) -> Result<(Res, Option), ErrorKind<'path>> { let tcx = self.cx.tcx; let no_res = || ResolutionFailure::NotResolved { - module_id: module_id, + module_id, partial_res: None, unresolved: path_str.into(), }; diff --git a/src/test/ui-fulldeps/regions-mock-tcx.rs b/src/test/ui-fulldeps/regions-mock-tcx.rs index 30e6272324068..c8d9dc0cdc256 100644 --- a/src/test/ui-fulldeps/regions-mock-tcx.rs +++ b/src/test/ui-fulldeps/regions-mock-tcx.rs @@ -55,11 +55,11 @@ struct TypeContext<'tcx, 'ast> { impl<'tcx,'ast> TypeContext<'tcx, 'ast> { fn new(ty_arena: &'tcx TyArena<'tcx>, ast_arena: &'ast AstArena<'ast>) -> TypeContext<'tcx, 'ast> { - TypeContext { ty_arena: ty_arena, + TypeContext { ty_arena, types: Vec::new(), type_table: HashMap::new(), - ast_arena: ast_arena, + ast_arena, ast_counter: 0 } } @@ -83,7 +83,7 @@ impl<'tcx,'ast> TypeContext<'tcx, 'ast> { fn ast(&mut self, a: AstKind<'ast>) -> Ast<'ast> { let id = self.ast_counter; self.ast_counter += 1; - self.ast_arena.alloc(AstStructure { id: NodeId {id:id}, kind: a }) + self.ast_arena.alloc(AstStructure { id: NodeId {id}, kind: a }) } } diff --git a/src/test/ui/alias-uninit-value.rs b/src/test/ui/alias-uninit-value.rs index 932c93245e6f9..400c2c3305943 100644 --- a/src/test/ui/alias-uninit-value.rs +++ b/src/test/ui/alias-uninit-value.rs @@ -14,7 +14,7 @@ enum sty { ty_nil, } struct RawT {struct_: sty, cname: Option, hash: usize} fn mk_raw_ty(st: sty, cname: Option) -> RawT { - return RawT {struct_: st, cname: cname, hash: 0}; + return RawT {struct_: st, cname, hash: 0}; } pub fn main() { mk_raw_ty(sty::ty_nil, None::); } diff --git a/src/test/ui/alignment-gep-tup-like-1.rs b/src/test/ui/alignment-gep-tup-like-1.rs index adbd05ed8c175..74c17c57690ce 100644 --- a/src/test/ui/alignment-gep-tup-like-1.rs +++ b/src/test/ui/alignment-gep-tup-like-1.rs @@ -26,8 +26,8 @@ impl Invokable for Invoker { fn f(a: A, b: u16) -> Box+'static> { box Invoker { - a: a, - b: b, + a, + b, } as Box+'static> } diff --git a/src/test/ui/array-slice-vec/destructure-array-1.rs b/src/test/ui/array-slice-vec/destructure-array-1.rs index 74d893ee5b282..67bced31da0a5 100644 --- a/src/test/ui/array-slice-vec/destructure-array-1.rs +++ b/src/test/ui/array-slice-vec/destructure-array-1.rs @@ -8,7 +8,7 @@ struct D { x: u8 } impl Drop for D { fn drop(&mut self) { } } fn main() { - fn d(x: u8) -> D { D { x: x } } + fn d(x: u8) -> D { D { x } } let d1 = foo([d(1), d(2), d(3), d(4)], 1); let d3 = foo([d(5), d(6), d(7), d(8)], 3); diff --git a/src/test/ui/array-slice-vec/vec-res-add.rs b/src/test/ui/array-slice-vec/vec-res-add.rs index 57b552ee55819..a4bcdba97ce02 100644 --- a/src/test/ui/array-slice-vec/vec-res-add.rs +++ b/src/test/ui/array-slice-vec/vec-res-add.rs @@ -3,7 +3,7 @@ struct R { i:isize } -fn r(i:isize) -> R { R { i: i } } +fn r(i:isize) -> R { R { i } } impl Drop for R { fn drop(&mut self) {} diff --git a/src/test/ui/associated-types/associated-types-normalize-unifield-struct.rs b/src/test/ui/associated-types/associated-types-normalize-unifield-struct.rs index a04525dcd462a..7cc36fcc5abca 100644 --- a/src/test/ui/associated-types/associated-types-normalize-unifield-struct.rs +++ b/src/test/ui/associated-types/associated-types-normalize-unifield-struct.rs @@ -17,7 +17,7 @@ impl OffsetState for Y {} pub fn now() -> DateTime { from_utc(Y) } pub struct DateTime { pub offset: Off::State } -pub fn from_utc(offset: Off::State) -> DateTime { DateTime { offset: offset } } +pub fn from_utc(offset: Off::State) -> DateTime { DateTime { offset } } pub fn main() { let _x = now(); diff --git a/src/test/ui/associated-types/associated-types-ref-from-struct.rs b/src/test/ui/associated-types/associated-types-ref-from-struct.rs index c89f6046e6bf2..1bea2c2c4c9cc 100644 --- a/src/test/ui/associated-types/associated-types-ref-from-struct.rs +++ b/src/test/ui/associated-types/associated-types-ref-from-struct.rs @@ -16,7 +16,7 @@ struct TesterPair { impl TesterPair { fn new(tester: T, value: T::V) -> TesterPair { - TesterPair { tester: tester, value: value } + TesterPair { tester, value } } fn test(&self) -> bool { diff --git a/src/test/ui/attributes/class-attributes-1.rs b/src/test/ui/attributes/class-attributes-1.rs index 027b701e591ba..531798f812a32 100644 --- a/src/test/ui/attributes/class-attributes-1.rs +++ b/src/test/ui/attributes/class-attributes-1.rs @@ -14,6 +14,6 @@ impl Drop for Cat { #[rustc_dummy] -fn cat(name: String) -> Cat { Cat{name: name,} } +fn cat(name: String) -> Cat { Cat{name,} } fn main() { let _kitty = cat("Spotty".to_string()); } diff --git a/src/test/ui/attributes/class-attributes-2.rs b/src/test/ui/attributes/class-attributes-2.rs index 6aba6b89427e4..335c90b61ad7e 100644 --- a/src/test/ui/attributes/class-attributes-2.rs +++ b/src/test/ui/attributes/class-attributes-2.rs @@ -22,7 +22,7 @@ Maybe it should technically be a kitten_maker. */ fn cat(name: String) -> Cat { Cat { - name: name + name } } diff --git a/src/test/ui/binop/binops.rs b/src/test/ui/binop/binops.rs index a7abf6087b303..dbb9ce549b9da 100644 --- a/src/test/ui/binop/binops.rs +++ b/src/test/ui/binop/binops.rs @@ -60,8 +60,8 @@ struct p { fn p(x: isize, y: isize) -> p { p { - x: x, - y: y + x, + y } } diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.rs b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.rs index e384aacb71845..815a0135ff5c7 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.rs +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.rs @@ -12,7 +12,7 @@ impl<'a> Drop for Defer<'a> { fn defer<'r>(x: &'r [&'r str]) -> Defer<'r> { Defer { - x: x + x } } diff --git a/src/test/ui/borrowck/fsu-moves-and-copies.rs b/src/test/ui/borrowck/fsu-moves-and-copies.rs index 6a0b4ed17b962..263bc19b15c92 100644 --- a/src/test/ui/borrowck/fsu-moves-and-copies.rs +++ b/src/test/ui/borrowck/fsu-moves-and-copies.rs @@ -8,7 +8,7 @@ #![feature(box_syntax, core)] struct ncint { v: isize } -fn ncint(v: isize) -> ncint { ncint { v: v } } +fn ncint(v: isize) -> ncint { ncint { v } } struct NoFoo { copied: isize, nocopy: ncint, } impl NoFoo { diff --git a/src/test/ui/cfg/conditional-compile.rs b/src/test/ui/cfg/conditional-compile.rs index 69f4de43186d5..7f2ad811f0040 100644 --- a/src/test/ui/cfg/conditional-compile.rs +++ b/src/test/ui/cfg/conditional-compile.rs @@ -46,7 +46,7 @@ struct r { #[cfg(bogus)] fn r(i: isize) -> r { - r { i: i } + r { i } } struct r { @@ -54,7 +54,7 @@ struct r { } fn r(i: isize) -> r { - r { i: i } + r { i } } #[cfg(bogus)] diff --git a/src/test/ui/cleanup-rvalue-for-scope.rs b/src/test/ui/cleanup-rvalue-for-scope.rs index b6582c01fbada..5c4df257476c4 100644 --- a/src/test/ui/cleanup-rvalue-for-scope.rs +++ b/src/test/ui/cleanup-rvalue-for-scope.rs @@ -14,7 +14,7 @@ struct Box { f: T } struct AddFlags { bits: u64 } fn AddFlags(bits: u64) -> AddFlags { - AddFlags { bits: bits } + AddFlags { bits } } fn arg(exp: u64, _x: &AddFlags) { diff --git a/src/test/ui/cleanup-rvalue-scopes-cf.rs b/src/test/ui/cleanup-rvalue-scopes-cf.rs index e3cecb1bffed6..dde50d813bf54 100644 --- a/src/test/ui/cleanup-rvalue-scopes-cf.rs +++ b/src/test/ui/cleanup-rvalue-scopes-cf.rs @@ -9,7 +9,7 @@ struct StackBox { f: T } struct AddFlags { bits: u64 } fn AddFlags(bits: u64) -> AddFlags { - AddFlags { bits: bits } + AddFlags { bits } } fn arg(x: &AddFlags) -> &AddFlags { diff --git a/src/test/ui/cleanup-rvalue-scopes.rs b/src/test/ui/cleanup-rvalue-scopes.rs index c5dd87c0f5a1f..c474e281ab118 100644 --- a/src/test/ui/cleanup-rvalue-scopes.rs +++ b/src/test/ui/cleanup-rvalue-scopes.rs @@ -17,7 +17,7 @@ struct Box { f: T } struct AddFlags { bits: u64 } fn AddFlags(bits: u64) -> AddFlags { - AddFlags { bits: bits } + AddFlags { bits } } fn arg(exp: u64, _x: &AddFlags) { diff --git a/src/test/ui/close-over-big-then-small-data.rs b/src/test/ui/close-over-big-then-small-data.rs index 4d6edf4ecb0f3..1719d22164091 100644 --- a/src/test/ui/close-over-big-then-small-data.rs +++ b/src/test/ui/close-over-big-then-small-data.rs @@ -28,8 +28,8 @@ impl Invokable for Invoker { fn f(a: A, b: u16) -> Box+'static> { box Invoker { - a: a, - b: b, + a, + b, } as Box+'static> } diff --git a/src/test/ui/confuse-field-and-method/private-field.rs b/src/test/ui/confuse-field-and-method/private-field.rs index 28b8935ac0daa..b134e0ba3f3ab 100644 --- a/src/test/ui/confuse-field-and-method/private-field.rs +++ b/src/test/ui/confuse-field-and-method/private-field.rs @@ -6,7 +6,7 @@ pub mod animal { impl Dog { pub fn new(age: usize) -> Dog { - Dog { age: age, dog_age: age * 7 } + Dog { age, dog_age: age * 7 } } } } diff --git a/src/test/ui/consts/issue-46553.rs b/src/test/ui/consts/issue-46553.rs index 0a1e835672de9..0c2552e65dbc0 100644 --- a/src/test/ui/consts/issue-46553.rs +++ b/src/test/ui/consts/issue-46553.rs @@ -9,7 +9,7 @@ pub struct Data { impl Data { pub const fn new(function: fn() -> T) -> Data { Data { - function: function, + function, } } } diff --git a/src/test/ui/copy-a-resource.rs b/src/test/ui/copy-a-resource.rs index 55f2dd4ee6dde..97306ad3421da 100644 --- a/src/test/ui/copy-a-resource.rs +++ b/src/test/ui/copy-a-resource.rs @@ -9,7 +9,7 @@ impl Drop for Foo { fn foo(i:isize) -> Foo { Foo { - i: i + i } } diff --git a/src/test/ui/cross-crate/xcrate-trait-lifetime-param.rs b/src/test/ui/cross-crate/xcrate-trait-lifetime-param.rs index 1fd7eb878d98a..bdf86a0b60b98 100644 --- a/src/test/ui/cross-crate/xcrate-trait-lifetime-param.rs +++ b/src/test/ui/cross-crate/xcrate-trait-lifetime-param.rs @@ -12,7 +12,7 @@ struct Reader<'a> { impl <'a> other::FromBuf<'a> for Reader<'a> { fn from_buf(b : &'a [u8]) -> Reader<'a> { - Reader { b : b } + Reader { b } } } diff --git a/src/test/ui/dep-graph/dep-graph-struct-signature.rs b/src/test/ui/dep-graph/dep-graph-struct-signature.rs index 50a670b877238..36d1551484650 100644 --- a/src/test/ui/dep-graph/dep-graph-struct-signature.rs +++ b/src/test/ui/dep-graph/dep-graph-struct-signature.rs @@ -39,7 +39,7 @@ mod signatures { #[rustc_then_this_would_need(fn_sig)] //~ ERROR OK #[rustc_then_this_would_need(typeck)] //~ ERROR OK fn new_foo(x: u32, y: u32) -> WillChange { - WillChange { x: x, y: y } + WillChange { x, y } } #[rustc_then_this_would_need(type_of)] //~ ERROR OK diff --git a/src/test/ui/derived-errors/issue-31997-1.rs b/src/test/ui/derived-errors/issue-31997-1.rs index 90c1b498cea73..52cc1c9ddb7a6 100644 --- a/src/test/ui/derived-errors/issue-31997-1.rs +++ b/src/test/ui/derived-errors/issue-31997-1.rs @@ -36,7 +36,7 @@ fn main() { let instance = words.iter().find(|a| a.starts_with("i-")).unwrap(); let name = words[1].to_owned(); let mut entry = map.entry(instance.to_owned()).or_insert(Instance { - name: name, + name, start: None, end: None, }); diff --git a/src/test/ui/drop/drop-trait-enum.rs b/src/test/ui/drop/drop-trait-enum.rs index aec46575f97fc..77dee0b1e233c 100644 --- a/src/test/ui/drop/drop-trait-enum.rs +++ b/src/test/ui/drop/drop-trait-enum.rs @@ -65,7 +65,7 @@ pub fn main() { let (sender, receiver) = channel(); let t = thread::spawn(move|| { - let v = Foo::FailingVariant { on_drop: SendOnDrop { sender: sender } }; + let v = Foo::FailingVariant { on_drop: SendOnDrop { sender } }; }); assert_eq!(receiver.recv().unwrap(), Message::Dropped); assert_eq!(receiver.recv().ok(), None); @@ -81,7 +81,7 @@ pub fn main() { SendOnDrop { sender: sender.clone() }, sender.clone()); v = Foo::SimpleVariant(sender.clone()); - v = Foo::FailingVariant { on_drop: SendOnDrop { sender: sender } }; + v = Foo::FailingVariant { on_drop: SendOnDrop { sender } }; }) }; assert_eq!(receiver.recv().unwrap(), Message::DestructorRan); diff --git a/src/test/ui/drop/dropck_legal_cycles.rs b/src/test/ui/drop/dropck_legal_cycles.rs index 27a599315dc1c..bd2d779715a48 100644 --- a/src/test/ui/drop/dropck_legal_cycles.rs +++ b/src/test/ui/drop/dropck_legal_cycles.rs @@ -450,7 +450,7 @@ struct S<'a> { impl<'a> Named for S<'a> { fn new(name: &'static str) -> S<'a> { - S { name: name, mark: Cell::new(0), next: Cell::new(None) } + S { name, mark: Cell::new(0), next: Cell::new(None) } } fn name(&self) -> &str { self.name } } @@ -468,7 +468,7 @@ struct S2<'a> { impl<'a> Named for S2<'a> { fn new(name: &'static str) -> S2<'a> { - S2 { name: name, mark: Cell::new(0), next: Cell::new((None, None)) } + S2 { name, mark: Cell::new(0), next: Cell::new((None, None)) } } fn name(&self) -> &str { self.name } } @@ -488,7 +488,7 @@ struct V<'a> { impl<'a> Named for V<'a> { fn new(name: &'static str) -> V<'a> { - V { name: name, + V { name, mark: Cell::new(0), contents: vec![Cell::new(None), Cell::new(None)] } @@ -510,7 +510,7 @@ struct H<'a> { impl<'a> Named for H<'a> { fn new(name: &'static str) -> H<'a> { - H { name: name, mark: Cell::new(0), next: Cell::new(None) } + H { name, mark: Cell::new(0), next: Cell::new(None) } } fn name(&self) -> &str { self.name } } @@ -541,7 +541,7 @@ struct HM<'a> { impl<'a> Named for HM<'a> { fn new(name: &'static str) -> HM<'a> { - HM { name: name, + HM { name, mark: Cell::new(0), contents: Cell::new(None) } @@ -575,7 +575,7 @@ struct VD<'a> { impl<'a> Named for VD<'a> { fn new(name: &'static str) -> VD<'a> { - VD { name: name, + VD { name, mark: Cell::new(0), contents: Cell::new(None) } @@ -596,7 +596,7 @@ struct VM<'a> { impl<'a> Named for VM<'a> { fn new(name: &'static str) -> VM<'a> { - VM { name: name, + VM { name, mark: Cell::new(0), contents: Cell::new(None) } @@ -617,7 +617,7 @@ struct LL<'a> { impl<'a> Named for LL<'a> { fn new(name: &'static str) -> LL<'a> { - LL { name: name, + LL { name, mark: Cell::new(0), contents: Cell::new(None) } @@ -638,7 +638,7 @@ struct BH<'a> { impl<'a> Named for BH<'a> { fn new(name: &'static str) -> BH<'a> { - BH { name: name, + BH { name, mark: Cell::new(0), contents: Cell::new(None) } @@ -679,7 +679,7 @@ struct BTM<'a> { impl<'a> Named for BTM<'a> { fn new(name: &'static str) -> BTM<'a> { - BTM { name: name, + BTM { name, mark: Cell::new(0), contents: Cell::new(None) } @@ -720,7 +720,7 @@ struct BTS<'a> { impl<'a> Named for BTS<'a> { fn new(name: &'static str) -> BTS<'a> { - BTS { name: name, + BTS { name, mark: Cell::new(0), contents: Cell::new(None) } @@ -765,7 +765,7 @@ struct RCRC<'a>(Rc>>); impl<'a> Named for RCRC<'a> { fn new(name: &'static str) -> Self { RCRC(Rc::new(RefCell::new(RCRCData { - name: name, mark: Cell::new(0), children: (None, None), }))) + name, mark: Cell::new(0), children: (None, None), }))) } fn name(&self) -> &str { self.0.borrow().name } } @@ -802,7 +802,7 @@ struct ARCRC<'a>(Arc>>); impl<'a> Named for ARCRC<'a> { fn new(name: &'static str) -> Self { ARCRC(Arc::new(RefCell::new(ARCRCData { - name: name, mark: Cell::new(0), children: (None, None), }))) + name, mark: Cell::new(0), children: (None, None), }))) } fn name(&self) -> &str { self.0.borrow().name } } @@ -885,7 +885,7 @@ struct ARCRW<'a>(Arc>>); impl<'a> Named for ARCRW<'a> { fn new(name: &'static str) -> Self { ARCRW(Arc::new(RwLock::new(ARCRWData { - name: name, mark: Cell::new(0), children: (None, None), }))) + name, mark: Cell::new(0), children: (None, None), }))) } fn name(&self) -> &str { self.0.read().unwrap().name } } diff --git a/src/test/ui/drop/dynamic-drop.rs b/src/test/ui/drop/dynamic-drop.rs index 7bb43d5b50360..e5127892d3069 100644 --- a/src/test/ui/drop/dynamic-drop.rs +++ b/src/test/ui/drop/dynamic-drop.rs @@ -35,7 +35,7 @@ impl Drop for Allocator { impl Allocator { fn new(failing_op: usize) -> Self { Allocator { - failing_op: failing_op, + failing_op, cur_ops: Cell::new(0), data: RefCell::new(vec![]) } diff --git a/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs b/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs index 500633edf12de..c8f57b300d5bc 100644 --- a/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs +++ b/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs @@ -13,7 +13,7 @@ mod foo { pub fn make_secrets(a: u8, b: String) -> S { let val = unsafe { let p = COUNT.get(); let val = *p; *p = val + 1; val }; println!("creating {}, uid {}", b, val); - S { a: a, b: b, secret_uid: val } + S { a, b, secret_uid: val } } impl Drop for S { diff --git a/src/test/ui/generics/issue-2936.rs b/src/test/ui/generics/issue-2936.rs index 6b932d01d55df..59f725ce52ab7 100644 --- a/src/test/ui/generics/issue-2936.rs +++ b/src/test/ui/generics/issue-2936.rs @@ -21,7 +21,7 @@ impl bar for cbar { fn cbar(x: isize) -> cbar { cbar { - x: x + x } } diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs index 41ebb3f5a14ab..d875556319d65 100644 --- a/src/test/ui/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs +++ b/src/test/ui/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs @@ -18,7 +18,7 @@ impl<'ast> PrinterSupport<'ast> for NoAnn<'ast> { } fn foo<'ast, G>(f: Option<&'ast usize>, g: G) where G: FnOnce(&dyn PrinterSupport) { - let annotation = NoAnn { f: f }; + let annotation = NoAnn { f }; g(&annotation) } diff --git a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-4.rs b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-4.rs index 8c2a59868ca5e..678f122688945 100644 --- a/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-4.rs +++ b/src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-62529-4.rs @@ -21,7 +21,7 @@ impl<'a, 'b> Container<'b> for &'a str { impl<'a, T> Test<'a, T> where T: for<'b> Container<'b> { fn new(root: RootOf<'a, T>) -> Test<'a, T> { Test { - root: root, + root, marker: PhantomData } } diff --git a/src/test/ui/hrtb/issue-30786.rs b/src/test/ui/hrtb/issue-30786.rs index 278c5441ecfb7..3d3196d7f39b6 100644 --- a/src/test/ui/hrtb/issue-30786.rs +++ b/src/test/ui/hrtb/issue-30786.rs @@ -80,7 +80,7 @@ where Self: Sized, for<'a> &'a mut Map: Stream, { - Map { func: func, stream: self } + Map { func, stream: self } } fn filterx(self, func: F) -> Filter @@ -88,7 +88,7 @@ where Self: Sized, for<'a> &'a mut Filter: Stream, { - Filter { func: func, stream: self } + Filter { func, stream: self } } fn countx(mut self) -> usize diff --git a/src/test/ui/impl-trait/example-calendar.rs b/src/test/ui/impl-trait/example-calendar.rs index 45dcb74a6e05c..08d7696e5db2c 100644 --- a/src/test/ui/impl-trait/example-calendar.rs +++ b/src/test/ui/impl-trait/example-calendar.rs @@ -602,7 +602,7 @@ where Self::Item: Iterator { iters: self.collect(), cache: vec![], col_widths: None, - sep_width: sep_width, + sep_width, } } } @@ -681,7 +681,7 @@ trait Chunks: Iterator + Sized { assert!(n > 0); ChunksIter { it: self, - n: n, + n, } } } diff --git a/src/test/ui/inference/deref-suggestion.rs b/src/test/ui/inference/deref-suggestion.rs index 4fd695585ba06..94e45263292b8 100644 --- a/src/test/ui/inference/deref-suggestion.rs +++ b/src/test/ui/inference/deref-suggestion.rs @@ -38,12 +38,14 @@ fn main() { let u = 3; let s = S { u }; //~^ ERROR mismatched types - let s = S { u: u }; + let u2 = u; + let s = S { u: u2 }; //~^ ERROR mismatched types let i = &4; let r = R { i }; //~^ ERROR mismatched types - let r = R { i: i }; + let i2 = i; + let r = R { i: i2 }; //~^ ERROR mismatched types diff --git a/src/test/ui/inference/deref-suggestion.stderr b/src/test/ui/inference/deref-suggestion.stderr index c5c8b8842979b..fffd616f1f497 100644 --- a/src/test/ui/inference/deref-suggestion.stderr +++ b/src/test/ui/inference/deref-suggestion.stderr @@ -70,16 +70,16 @@ LL | let s = S { u }; | help: consider borrowing here: `u: &u` error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:41:20 + --> $DIR/deref-suggestion.rs:42:20 | -LL | let s = S { u: u }; - | ^ +LL | let s = S { u: u2 }; + | ^^ | | | expected `&u32`, found integer - | help: consider borrowing here: `&u` + | help: consider borrowing here: `&u2` error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:44:17 + --> $DIR/deref-suggestion.rs:45:17 | LL | let r = R { i }; | ^ expected `u32`, found `&{integer}` @@ -90,18 +90,18 @@ LL | let r = R { i: *i }; | ~~~~~ error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:46:20 + --> $DIR/deref-suggestion.rs:48:20 | -LL | let r = R { i: i }; - | ^ expected `u32`, found `&{integer}` +LL | let r = R { i: i2 }; + | ^^ expected `u32`, found `&{integer}` | help: consider dereferencing the borrow | -LL | let r = R { i: *i }; +LL | let r = R { i: *i2 }; | + error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:55:9 + --> $DIR/deref-suggestion.rs:57:9 | LL | b | ^ expected `i32`, found `&{integer}` @@ -112,7 +112,7 @@ LL | *b | + error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:63:9 + --> $DIR/deref-suggestion.rs:65:9 | LL | b | ^ expected `i32`, found `&{integer}` @@ -123,7 +123,7 @@ LL | *b | + error[E0308]: `if` and `else` have incompatible types - --> $DIR/deref-suggestion.rs:68:12 + --> $DIR/deref-suggestion.rs:70:12 | LL | let val = if true { | _______________- diff --git a/src/test/ui/init-res-into-things.rs b/src/test/ui/init-res-into-things.rs index ed0c600c1d2e7..95cf1fe26f0c9 100644 --- a/src/test/ui/init-res-into-things.rs +++ b/src/test/ui/init-res-into-things.rs @@ -23,7 +23,7 @@ impl<'a> Drop for r<'a> { fn r(i: &Cell) -> r { r { - i: i + i } } diff --git a/src/test/ui/issues/issue-10802.rs b/src/test/ui/issues/issue-10802.rs index f1d6b37a6843f..70ad6f73e77c0 100644 --- a/src/test/ui/issues/issue-10802.rs +++ b/src/test/ui/issues/issue-10802.rs @@ -27,7 +27,7 @@ impl MyTrait for Box {} struct Whatever { w: Box } impl Whatever { fn new(w: Box) -> Whatever { - Whatever { w: w } + Whatever { w } } } diff --git a/src/test/ui/issues/issue-10902.rs b/src/test/ui/issues/issue-10902.rs index 162482d49abd5..d1ba8fe3f2e28 100644 --- a/src/test/ui/issues/issue-10902.rs +++ b/src/test/ui/issues/issue-10902.rs @@ -14,7 +14,7 @@ pub mod two_fields { pub trait T { fn dummy(&self) { } } pub struct P<'a> { car: &'a (dyn T + 'a), cdr: &'a (dyn T + 'a) } pub fn f<'a>(car: &'a dyn T, cdr: &'a dyn T) -> P<'a> { - P{ car: car, cdr: cdr } + P{ car, cdr } } } diff --git a/src/test/ui/issues/issue-11374.rs b/src/test/ui/issues/issue-11374.rs index 7519ba2826e7a..376e370c8829d 100644 --- a/src/test/ui/issues/issue-11374.rs +++ b/src/test/ui/issues/issue-11374.rs @@ -7,7 +7,7 @@ pub struct Container<'a> { impl<'a> Container<'a> { pub fn wrap<'s>(reader: &'s mut dyn io::Read) -> Container<'s> { - Container { reader: reader } + Container { reader } } pub fn read_to(&mut self, vec: &mut [u8]) { diff --git a/src/test/ui/issues/issue-13264.rs b/src/test/ui/issues/issue-13264.rs index 691bb63a2feb8..8ecde71a6e992 100644 --- a/src/test/ui/issues/issue-13264.rs +++ b/src/test/ui/issues/issue-13264.rs @@ -64,7 +64,7 @@ impl Node { fn main() { let n = Node; let jsref = JSRef { node: &n }; - let root = Root { jsref: jsref }; + let root = Root { jsref }; root.AddChild(); jsref.AddChild(); diff --git a/src/test/ui/issues/issue-13323.rs b/src/test/ui/issues/issue-13323.rs index 26847ee7a0839..f5842ef0ace37 100644 --- a/src/test/ui/issues/issue-13323.rs +++ b/src/test/ui/issues/issue-13323.rs @@ -48,7 +48,7 @@ impl Matcher for EqualTo { } fn equal_to(expected: T) -> Box> { - box EqualTo { expected: expected } + box EqualTo { expected } } pub fn main() { diff --git a/src/test/ui/issues/issue-14821.rs b/src/test/ui/issues/issue-14821.rs index 00b2e3607fcba..344774219b228 100644 --- a/src/test/ui/issues/issue-14821.rs +++ b/src/test/ui/issues/issue-14821.rs @@ -11,7 +11,7 @@ struct Foo<'a> { } impl<'a> Foo<'a> { - pub fn new<'b>(x: &'b dyn SomeTrait, y: &'b dyn SomeTrait) -> Foo<'b> { Foo { x: x, y: y } } + pub fn new<'b>(x: &'b dyn SomeTrait, y: &'b dyn SomeTrait) -> Foo<'b> { Foo { x, y } } } fn main() { diff --git a/src/test/ui/issues/issue-15034.rs b/src/test/ui/issues/issue-15034.rs index 9ea6ed89ca249..ab1fde1ff1863 100644 --- a/src/test/ui/issues/issue-15034.rs +++ b/src/test/ui/issues/issue-15034.rs @@ -4,7 +4,7 @@ pub struct Lexer<'a> { impl<'a> Lexer<'a> { pub fn new(input: &'a str) -> Lexer<'a> { - Lexer { input: input } + Lexer { input } } } @@ -14,7 +14,7 @@ struct Parser<'a> { impl<'a> Parser<'a> { pub fn new(lexer: &'a mut Lexer) -> Parser<'a> { - Parser { lexer: lexer } + Parser { lexer } //~^ ERROR explicit lifetime required in the type of `lexer` [E0621] } } diff --git a/src/test/ui/issues/issue-15034.stderr b/src/test/ui/issues/issue-15034.stderr index 3ede5ba4fa30a..c788a753c7c26 100644 --- a/src/test/ui/issues/issue-15034.stderr +++ b/src/test/ui/issues/issue-15034.stderr @@ -1,10 +1,10 @@ error[E0621]: explicit lifetime required in the type of `lexer` - --> $DIR/issue-15034.rs:17:25 + --> $DIR/issue-15034.rs:17:18 | LL | pub fn new(lexer: &'a mut Lexer) -> Parser<'a> { | ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>` -LL | Parser { lexer: lexer } - | ^^^^^ lifetime `'a` required +LL | Parser { lexer } + | ^^^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/issues/issue-15094.rs b/src/test/ui/issues/issue-15094.rs index 71b75a6e7e00f..4dc3e95e35665 100644 --- a/src/test/ui/issues/issue-15094.rs +++ b/src/test/ui/issues/issue-15094.rs @@ -17,7 +17,7 @@ impl ops::FnOnce<(),> for Debuger { } fn make_shower(x: T) -> Debuger { - Debuger { x: x } + Debuger { x } } pub fn main() { diff --git a/src/test/ui/issues/issue-15734.rs b/src/test/ui/issues/issue-15734.rs index be582060601e7..487f97e08284f 100644 --- a/src/test/ui/issues/issue-15734.rs +++ b/src/test/ui/issues/issue-15734.rs @@ -8,10 +8,10 @@ struct Mat { data: Vec, cols: usize, } impl Mat { fn new(data: Vec, cols: usize) -> Mat { - Mat { data: data, cols: cols } + Mat { data, cols } } fn row<'a>(&'a self, row: usize) -> Row<&'a Mat> { - Row { mat: self, row: row, } + Row { mat: self, row, } } } diff --git a/src/test/ui/issues/issue-16048.rs b/src/test/ui/issues/issue-16048.rs index eaf6acff26bf3..4a3ed75d505df 100644 --- a/src/test/ui/issues/issue-16048.rs +++ b/src/test/ui/issues/issue-16048.rs @@ -13,7 +13,7 @@ struct Foo<'a> { impl<'a> Test<'a> for Foo<'a> { fn new(buf: &'a mut [u8]) -> Foo<'a> { - Foo { buf: buf } + Foo { buf } } } diff --git a/src/test/ui/issues/issue-16492.rs b/src/test/ui/issues/issue-16492.rs index 7fa808237bf09..743d210afd9e9 100644 --- a/src/test/ui/issues/issue-16492.rs +++ b/src/test/ui/issues/issue-16492.rs @@ -12,8 +12,8 @@ struct Field { impl Field { fn new(number: usize, state: Rc>) -> Field { Field { - number: number, - state: state + number, + state } } } diff --git a/src/test/ui/issues/issue-20797.rs b/src/test/ui/issues/issue-20797.rs index ef0e72571efb2..340a9c2018d27 100644 --- a/src/test/ui/issues/issue-20797.rs +++ b/src/test/ui/issues/issue-20797.rs @@ -46,7 +46,7 @@ impl Subpaths { /// Creates a directory walker with a root path and strategy. pub fn new(p: &S::P, strategy: S) -> io::Result> { let stack = strategy.get_more(p)?; - Ok(Subpaths { stack: stack, strategy: strategy }) + Ok(Subpaths { stack, strategy }) } } diff --git a/src/test/ui/issues/issue-23338-ensure-param-drop-order.rs b/src/test/ui/issues/issue-23338-ensure-param-drop-order.rs index a99f260dde3b2..cff575304d683 100644 --- a/src/test/ui/issues/issue-23338-ensure-param-drop-order.rs +++ b/src/test/ui/issues/issue-23338-ensure-param-drop-order.rs @@ -140,7 +140,7 @@ pub mod d { counter += 1; trails |= (1 << trail); let ret = D { - name: name, i: i, log: log, uid: ctr, trail: trail + name, i, log, uid: ctr, trail }; indent_println(trail, &format!("+-- Make {}", ret)); ret diff --git a/src/test/ui/issues/issue-23611-enum-swap-in-drop.rs b/src/test/ui/issues/issue-23611-enum-swap-in-drop.rs index 403cf970bcb0a..24d1cf6b2ac52 100644 --- a/src/test/ui/issues/issue-23611-enum-swap-in-drop.rs +++ b/src/test/ui/issues/issue-23611-enum-swap-in-drop.rs @@ -240,7 +240,7 @@ pub mod d { counter += 1; trails |= (1 << trail); let ret = D { - name: name, i: i, log: log, uid: ctr, trail: trail + name, i, log, uid: ctr, trail }; indent_println(trail, &format!("+-- Make {}", ret)); ret diff --git a/src/test/ui/issues/issue-2445-b.rs b/src/test/ui/issues/issue-2445-b.rs index f369eae3af348..d9472f7b1386d 100644 --- a/src/test/ui/issues/issue-2445-b.rs +++ b/src/test/ui/issues/issue-2445-b.rs @@ -15,7 +15,7 @@ impl c1 { fn c1(x: T) -> c1 { c1 { - x: x + x } } diff --git a/src/test/ui/issues/issue-2445.rs b/src/test/ui/issues/issue-2445.rs index 5730ce165748e..eb8e6eb71193f 100644 --- a/src/test/ui/issues/issue-2445.rs +++ b/src/test/ui/issues/issue-2445.rs @@ -14,7 +14,7 @@ impl c1 { fn c1(x: T) -> c1 { c1 { - x: x + x } } diff --git a/src/test/ui/issues/issue-2502.rs b/src/test/ui/issues/issue-2502.rs index 63151002438c3..f61bf35ead3f1 100644 --- a/src/test/ui/issues/issue-2502.rs +++ b/src/test/ui/issues/issue-2502.rs @@ -17,7 +17,7 @@ impl<'a> font<'a> { fn font(fontbuf: &Vec ) -> font { font { - fontbuf: fontbuf + fontbuf } } diff --git a/src/test/ui/issues/issue-2550.rs b/src/test/ui/issues/issue-2550.rs index 04ec66b80d7bb..d078de54236f6 100644 --- a/src/test/ui/issues/issue-2550.rs +++ b/src/test/ui/issues/issue-2550.rs @@ -10,7 +10,7 @@ struct C { fn C(x: usize) -> C { C { - x: x + x } } diff --git a/src/test/ui/issues/issue-2735-2.rs b/src/test/ui/issues/issue-2735-2.rs index 70ebce9d35a79..1e190c8cc9862 100644 --- a/src/test/ui/issues/issue-2735-2.rs +++ b/src/test/ui/issues/issue-2735-2.rs @@ -16,7 +16,7 @@ impl<'a> Drop for defer<'a> { fn defer(b: &Cell) -> defer { defer { - b: b + b } } diff --git a/src/test/ui/issues/issue-2735-3.rs b/src/test/ui/issues/issue-2735-3.rs index 2330153783572..2938caf05c98a 100644 --- a/src/test/ui/issues/issue-2735-3.rs +++ b/src/test/ui/issues/issue-2735-3.rs @@ -16,7 +16,7 @@ impl<'a> Drop for defer<'a> { fn defer(b: &Cell) -> defer { defer { - b: b + b } } diff --git a/src/test/ui/issues/issue-2748-a.rs b/src/test/ui/issues/issue-2748-a.rs index cbb9bcc28ac8b..dd68cd6732eee 100644 --- a/src/test/ui/issues/issue-2748-a.rs +++ b/src/test/ui/issues/issue-2748-a.rs @@ -10,7 +10,7 @@ struct CMap<'a> { fn CMap(buf: &[u8]) -> CMap { CMap { - buf: buf + buf } } diff --git a/src/test/ui/issues/issue-3149.rs b/src/test/ui/issues/issue-3149.rs index 6ab3bc846a3e3..45204815c65e7 100644 --- a/src/test/ui/issues/issue-3149.rs +++ b/src/test/ui/issues/issue-3149.rs @@ -9,10 +9,10 @@ fn Matrix4(m11: T, m12: T, m13: T, m14: T, m41: T, m42: T, m43: T, m44: T) -> Matrix4 { Matrix4 { - m11: m11, m12: m12, m13: m13, m14: m14, - m21: m21, m22: m22, m23: m23, m24: m24, - m31: m31, m32: m32, m33: m33, m34: m34, - m41: m41, m42: m42, m43: m43, m44: m44 + m11, m12, m13, m14, + m21, m22, m23, m24, + m31, m32, m33, m34, + m41, m42, m43, m44 } } diff --git a/src/test/ui/issues/issue-3154.rs b/src/test/ui/issues/issue-3154.rs index 91c7203c1d002..b23ed30f4c9a7 100644 --- a/src/test/ui/issues/issue-3154.rs +++ b/src/test/ui/issues/issue-3154.rs @@ -3,7 +3,7 @@ struct Thing<'a, Q:'a> { } fn thing<'a,Q>(x: &Q) -> Thing<'a,Q> { - Thing { x: x } //~ ERROR explicit lifetime required in the type of `x` [E0621] + Thing { x } //~ ERROR explicit lifetime required in the type of `x` [E0621] } fn main() { diff --git a/src/test/ui/issues/issue-3154.stderr b/src/test/ui/issues/issue-3154.stderr index da2af83ff03c3..40c6b304fc522 100644 --- a/src/test/ui/issues/issue-3154.stderr +++ b/src/test/ui/issues/issue-3154.stderr @@ -3,8 +3,8 @@ error[E0621]: explicit lifetime required in the type of `x` | LL | fn thing<'a,Q>(x: &Q) -> Thing<'a,Q> { | -- help: add explicit lifetime `'a` to the type of `x`: `&'a Q` -LL | Thing { x: x } - | ^^^^^^^^^^^^^^ lifetime `'a` required +LL | Thing { x } + | ^^^^^^^^^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3447.rs b/src/test/ui/issues/issue-3447.rs index 1e329d1522af4..5f984f27b29ed 100644 --- a/src/test/ui/issues/issue-3447.rs +++ b/src/test/ui/issues/issue-3447.rs @@ -16,7 +16,7 @@ struct list { impl list { pub fn addEnd(&mut self, element: T) { let newList = list { - element: element, + element, next: None }; diff --git a/src/test/ui/issues/issue-3563-3.rs b/src/test/ui/issues/issue-3563-3.rs index bedfdab97d58b..2a6569bf36901 100644 --- a/src/test/ui/issues/issue-3563-3.rs +++ b/src/test/ui/issues/issue-3563-3.rs @@ -66,7 +66,7 @@ fn AsciiArt(width: usize, height: usize, fill: char) -> AsciiArt { // Rust code often returns values by omitting the trailing semi-colon // instead of using an explicit return statement. - AsciiArt {width: width, height: height, fill: fill, lines: lines} + AsciiArt {width, height, fill, lines} } // Methods particular to the AsciiArt struct. diff --git a/src/test/ui/issues/issue-3973.rs b/src/test/ui/issues/issue-3973.rs index a5ed5b87051e7..17bf627778c44 100644 --- a/src/test/ui/issues/issue-3973.rs +++ b/src/test/ui/issues/issue-3973.rs @@ -10,7 +10,7 @@ trait ToString_ { impl ToString_ for Point { fn new(x: f64, y: f64) -> Point { //~^ ERROR method `new` is not a member of trait `ToString_` - Point { x: x, y: y } + Point { x, y } } fn to_string(&self) -> String { diff --git a/src/test/ui/issues/issue-3973.stderr b/src/test/ui/issues/issue-3973.stderr index 63282e8d86d7b..51ec1dcd72720 100644 --- a/src/test/ui/issues/issue-3973.stderr +++ b/src/test/ui/issues/issue-3973.stderr @@ -3,7 +3,7 @@ error[E0407]: method `new` is not a member of trait `ToString_` | LL | / fn new(x: f64, y: f64) -> Point { LL | | -LL | | Point { x: x, y: y } +LL | | Point { x, y } LL | | } | |_____^ not a member of trait `ToString_` diff --git a/src/test/ui/issues/issue-41880.rs b/src/test/ui/issues/issue-41880.rs index 977c43b71fb71..02f971caf00da 100644 --- a/src/test/ui/issues/issue-41880.rs +++ b/src/test/ui/issues/issue-41880.rs @@ -1,7 +1,7 @@ fn iterate(initial: T, f: F) -> Iterate { Iterate { state: initial, - f: f, + f, } } diff --git a/src/test/ui/issues/issue-48132.rs b/src/test/ui/issues/issue-48132.rs index f564aefe78ced..3414ae427ee1c 100644 --- a/src/test/ui/issues/issue-48132.rs +++ b/src/test/ui/issues/issue-48132.rs @@ -20,7 +20,7 @@ where I: Iterator, { Outer { inner: Inner { - iterator: iterator, + iterator, item: Default::default(), } } diff --git a/src/test/ui/issues/issue-48179.rs b/src/test/ui/issues/issue-48179.rs index f81203dc41299..f4cf123f99a64 100644 --- a/src/test/ui/issues/issue-48179.rs +++ b/src/test/ui/issues/issue-48179.rs @@ -20,7 +20,7 @@ pub struct Wrapper<'a> { impl<'a, 'de> Wrapper<'a> { pub fn new(content: &'a Content) -> Self { Wrapper { - content: content, + content, } } } diff --git a/src/test/ui/issues/issue-5192.rs b/src/test/ui/issues/issue-5192.rs index 5a83d1c2ff9fd..6a88982d6133b 100644 --- a/src/test/ui/issues/issue-5192.rs +++ b/src/test/ui/issues/issue-5192.rs @@ -31,7 +31,7 @@ impl Scheduler { pub fn new(event_loop: Box) -> Scheduler { Scheduler { - event_loop: event_loop, + event_loop, } } } diff --git a/src/test/ui/issues/issue-5708.rs b/src/test/ui/issues/issue-5708.rs index 6fe9943d3689f..beb27b9d71d00 100644 --- a/src/test/ui/issues/issue-5708.rs +++ b/src/test/ui/issues/issue-5708.rs @@ -27,7 +27,7 @@ struct Outer<'a> { impl<'a> Outer<'a> { fn new(inner: &dyn Inner) -> Outer { Outer { - inner: inner + inner } } } diff --git a/src/test/ui/issues/issue-5883.rs b/src/test/ui/issues/issue-5883.rs index 82866b355573c..bceef45937e01 100644 --- a/src/test/ui/issues/issue-5883.rs +++ b/src/test/ui/issues/issue-5883.rs @@ -7,7 +7,7 @@ struct Struct { fn new_struct( r: dyn A + 'static //~ ERROR the size for values of type ) -> Struct { //~ ERROR the size for values of type - Struct { r: r } + Struct { r } } fn main() {} diff --git a/src/test/ui/issues/issue-5883.stderr b/src/test/ui/issues/issue-5883.stderr index 8a20a60853a63..eb28d9d5587be 100644 --- a/src/test/ui/issues/issue-5883.stderr +++ b/src/test/ui/issues/issue-5883.stderr @@ -16,8 +16,8 @@ error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at | LL | ) -> Struct { | ^^^^^^ doesn't have a size known at compile-time -LL | Struct { r: r } - | --------------- this returned value is of type `Struct` +LL | Struct { r } + | ------------ this returned value is of type `Struct` | = help: within `Struct`, the trait `Sized` is not implemented for `(dyn A + 'static)` note: required because it appears within the type `Struct` diff --git a/src/test/ui/issues/issue-60057.rs b/src/test/ui/issues/issue-60057.rs index b52343adaee71..b1aa389dd8879 100644 --- a/src/test/ui/issues/issue-60057.rs +++ b/src/test/ui/issues/issue-60057.rs @@ -5,13 +5,13 @@ struct A { impl A { fn new(peach: u8) -> A { A { - banana: banana //~ ERROR cannot find value `banana` in this scope + banana //~ ERROR cannot find value `banana` in this scope } } fn foo(&self, peach: u8) -> A { A { - banana: banana //~ ERROR cannot find value `banana` in this scope + banana //~ ERROR cannot find value `banana` in this scope } } } diff --git a/src/test/ui/issues/issue-60057.stderr b/src/test/ui/issues/issue-60057.stderr index 4d915fcd9fe3d..13ca24dd06e85 100644 --- a/src/test/ui/issues/issue-60057.stderr +++ b/src/test/ui/issues/issue-60057.stderr @@ -1,14 +1,14 @@ error[E0425]: cannot find value `banana` in this scope - --> $DIR/issue-60057.rs:8:21 + --> $DIR/issue-60057.rs:8:13 | -LL | banana: banana - | ^^^^^^ a field by this name exists in `Self` +LL | banana + | ^^^^^^ a field by this name exists in `Self` error[E0425]: cannot find value `banana` in this scope - --> $DIR/issue-60057.rs:14:21 + --> $DIR/issue-60057.rs:14:13 | -LL | banana: banana - | ^^^^^^ help: you might have meant to use the available field: `self.banana` +LL | banana + | ^^^^^^ help: you might have meant to use the available field: `self.banana` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-979.rs b/src/test/ui/issues/issue-979.rs index 57a99b325ad8e..d16b57446d013 100644 --- a/src/test/ui/issues/issue-979.rs +++ b/src/test/ui/issues/issue-979.rs @@ -15,7 +15,7 @@ impl<'a> Drop for r<'a> { fn r(b: &Cell) -> r { r { - b: b + b } } diff --git a/src/test/ui/lint/lint-shorthand-field.fixed b/src/test/ui/lint/lint-shorthand-field.fixed index 7cd5717bc5aac..78061238b5ef2 100644 --- a/src/test/ui/lint/lint-shorthand-field.fixed +++ b/src/test/ui/lint/lint-shorthand-field.fixed @@ -37,7 +37,7 @@ fn main() { struct x; - match (Bar { x: x }) { + match (Bar { x }) { Bar { x: x } => {}, } } diff --git a/src/test/ui/lint/lint-shorthand-field.rs b/src/test/ui/lint/lint-shorthand-field.rs index 22de9c3254590..580b2cc78c455 100644 --- a/src/test/ui/lint/lint-shorthand-field.rs +++ b/src/test/ui/lint/lint-shorthand-field.rs @@ -37,7 +37,7 @@ fn main() { struct x; - match (Bar { x: x }) { + match (Bar { x }) { Bar { x: x } => {}, } } diff --git a/src/tools/clippy/tests/ui/redundant_field_names.fixed b/src/test/ui/lint/redundant_field_initializers.fixed similarity index 66% rename from src/tools/clippy/tests/ui/redundant_field_names.fixed rename to src/test/ui/lint/redundant_field_initializers.fixed index 5b4b8eeedd469..f7fbf73df00a4 100644 --- a/src/tools/clippy/tests/ui/redundant_field_names.fixed +++ b/src/test/ui/lint/redundant_field_initializers.fixed @@ -1,9 +1,6 @@ // run-rustfix -#![warn(clippy::redundant_field_names)] -#![allow(clippy::no_effect, dead_code, unused_variables)] - -#[macro_use] -extern crate derive_new; +#![deny(redundant_field_initializers)] +#![allow(dead_code, unused_variables)] use std::ops::{Range, RangeFrom, RangeInclusive, RangeTo, RangeToInclusive}; @@ -19,11 +16,6 @@ struct Person { foo: u8, } -#[derive(new)] -pub struct S { - v: String, -} - fn main() { let gender: u8 = 42; let age = 0; @@ -32,7 +24,9 @@ fn main() { let me = Person { gender, + //~^ ERROR redundant field names age, + //~^ ERROR redundant field names name, //should be ok buzz: fizz, //should be ok @@ -53,11 +47,14 @@ fn main() { let _: Vec<_> = (start..end).collect(); // hand-written Range family structs are linted - let _ = RangeFrom { start }; - let _ = RangeTo { end }; - let _ = Range { start, end }; + let _ = RangeFrom { start }; //~ ERROR redundant field names + let _ = RangeTo { end }; //~ ERROR redundant field names + let _ = Range { + start, //~ ERROR redundant field names + end //~ ERROR redundant field names + }; let _ = RangeInclusive::new(start, end); - let _ = RangeToInclusive { end }; + let _ = RangeToInclusive { end }; //~ ERROR redundant field names } fn issue_3476() { diff --git a/src/tools/clippy/tests/ui/redundant_field_names.rs b/src/test/ui/lint/redundant_field_initializers.rs similarity index 65% rename from src/tools/clippy/tests/ui/redundant_field_names.rs rename to src/test/ui/lint/redundant_field_initializers.rs index 3f97b80c56828..bfdcabcf9b5ad 100644 --- a/src/tools/clippy/tests/ui/redundant_field_names.rs +++ b/src/test/ui/lint/redundant_field_initializers.rs @@ -1,9 +1,6 @@ // run-rustfix -#![warn(clippy::redundant_field_names)] -#![allow(clippy::no_effect, dead_code, unused_variables)] - -#[macro_use] -extern crate derive_new; +#![deny(redundant_field_initializers)] +#![allow(dead_code, unused_variables)] use std::ops::{Range, RangeFrom, RangeInclusive, RangeTo, RangeToInclusive}; @@ -19,11 +16,6 @@ struct Person { foo: u8, } -#[derive(new)] -pub struct S { - v: String, -} - fn main() { let gender: u8 = 42; let age = 0; @@ -32,7 +24,9 @@ fn main() { let me = Person { gender: gender, + //~^ ERROR redundant field names age: age, + //~^ ERROR redundant field names name, //should be ok buzz: fizz, //should be ok @@ -53,11 +47,14 @@ fn main() { let _: Vec<_> = (start..end).collect(); // hand-written Range family structs are linted - let _ = RangeFrom { start: start }; - let _ = RangeTo { end: end }; - let _ = Range { start: start, end: end }; + let _ = RangeFrom { start: start }; //~ ERROR redundant field names + let _ = RangeTo { end: end }; //~ ERROR redundant field names + let _ = Range { + start: start, //~ ERROR redundant field names + end: end //~ ERROR redundant field names + }; let _ = RangeInclusive::new(start, end); - let _ = RangeToInclusive { end: end }; + let _ = RangeToInclusive { end: end }; //~ ERROR redundant field names } fn issue_3476() { diff --git a/src/tools/clippy/tests/ui/redundant_field_names.stderr b/src/test/ui/lint/redundant_field_initializers.stderr similarity index 59% rename from src/tools/clippy/tests/ui/redundant_field_names.stderr rename to src/test/ui/lint/redundant_field_initializers.stderr index 7976292df2241..08055cf2995b3 100644 --- a/src/tools/clippy/tests/ui/redundant_field_names.stderr +++ b/src/test/ui/lint/redundant_field_initializers.stderr @@ -1,43 +1,47 @@ error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:34:9 + --> $DIR/redundant_field_initializers.rs:26:9 | LL | gender: gender, | ^^^^^^^^^^^^^^ help: replace it with: `gender` | - = note: `-D clippy::redundant-field-names` implied by `-D warnings` +note: the lint level is defined here + --> $DIR/redundant_field_initializers.rs:2:9 + | +LL | #![deny(redundant_field_initializers)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:35:9 + --> $DIR/redundant_field_initializers.rs:28:9 | LL | age: age, | ^^^^^^^^ help: replace it with: `age` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:56:25 + --> $DIR/redundant_field_initializers.rs:50:25 | LL | let _ = RangeFrom { start: start }; | ^^^^^^^^^^^^ help: replace it with: `start` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:57:23 + --> $DIR/redundant_field_initializers.rs:51:23 | LL | let _ = RangeTo { end: end }; | ^^^^^^^^ help: replace it with: `end` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:58:21 + --> $DIR/redundant_field_initializers.rs:53:9 | -LL | let _ = Range { start: start, end: end }; - | ^^^^^^^^^^^^ help: replace it with: `start` +LL | start: start, + | ^^^^^^^^^^^^ help: replace it with: `start` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:58:35 + --> $DIR/redundant_field_initializers.rs:54:9 | -LL | let _ = Range { start: start, end: end }; - | ^^^^^^^^ help: replace it with: `end` +LL | end: end + | ^^^^^^^^ help: replace it with: `end` error: redundant field names in struct initialization - --> $DIR/redundant_field_names.rs:60:32 + --> $DIR/redundant_field_initializers.rs:57:32 | LL | let _ = RangeToInclusive { end: end }; | ^^^^^^^^ help: replace it with: `end` diff --git a/src/test/ui/max-min-classes.rs b/src/test/ui/max-min-classes.rs index f9a39e486da2e..cdfa22faa22e1 100644 --- a/src/test/ui/max-min-classes.rs +++ b/src/test/ui/max-min-classes.rs @@ -23,7 +23,7 @@ impl Product for Foo { } fn Foo(x: isize, y: isize) -> Foo { - Foo { x: x, y: y } + Foo { x, y } } pub fn main() { diff --git a/src/test/ui/mir/mir_drop_order.rs b/src/test/ui/mir/mir_drop_order.rs index 22c804abf5cc8..61fa49edb2d45 100644 --- a/src/test/ui/mir/mir_drop_order.rs +++ b/src/test/ui/mir/mir_drop_order.rs @@ -20,7 +20,7 @@ struct InjectedFailure; #[allow(unreachable_code)] fn main() { let log = panic::AssertUnwindSafe(RefCell::new(vec![])); - let d = |id| DropLogger { id: id, log: &log }; + let d = |id| DropLogger { id, log: &log }; let get = || -> Vec<_> { let mut m = log.0.borrow_mut(); let n = m.drain(..); diff --git a/src/test/ui/mpsc_stress.rs b/src/test/ui/mpsc_stress.rs index a889542fec0be..06e87cbb2dc21 100644 --- a/src/test/ui/mpsc_stress.rs +++ b/src/test/ui/mpsc_stress.rs @@ -24,7 +24,7 @@ struct Barrier { impl Barrier { fn new(count: usize) -> Vec { let shared = Arc::new(AtomicUsize::new(0)); - (0..count).map(|_| Barrier { shared: shared.clone(), count: count }).collect() + (0..count).map(|_| Barrier { shared: shared.clone(), count }).collect() } fn new2() -> (Barrier, Barrier) { diff --git a/src/test/ui/nested-class.rs b/src/test/ui/nested-class.rs index 303273618e18d..62eb31943689c 100644 --- a/src/test/ui/nested-class.rs +++ b/src/test/ui/nested-class.rs @@ -13,7 +13,7 @@ pub fn main() { fn b(i:isize) -> b { b { - i: i + i } } diff --git a/src/test/ui/newtype.rs b/src/test/ui/newtype.rs index f02b66f450f34..b3972eecff87c 100644 --- a/src/test/ui/newtype.rs +++ b/src/test/ui/newtype.rs @@ -16,7 +16,7 @@ fn compute(i: mytype) -> isize { } pub fn main() { - let myval = mytype(Mytype{compute: compute, val: 30}); + let myval = mytype(Mytype{compute, val: 30}); println!("{}", compute(myval)); let mytype(m) = myval; assert_eq!((m.compute)(myval), 50); diff --git a/src/test/ui/nll/ty-outlives/issue-53789-2.rs b/src/test/ui/nll/ty-outlives/issue-53789-2.rs index d15e402460794..9bd9be154d730 100644 --- a/src/test/ui/nll/ty-outlives/issue-53789-2.rs +++ b/src/test/ui/nll/ty-outlives/issue-53789-2.rs @@ -102,8 +102,8 @@ struct VecStrategy { fn vec(element: T, size: Range) -> VecStrategy { VecStrategy { - element: element, - size: size, + element, + size, } } diff --git a/src/test/ui/noncopyable-class.rs b/src/test/ui/noncopyable-class.rs index 11b6eb736e9db..bbad13bbff2a4 100644 --- a/src/test/ui/noncopyable-class.rs +++ b/src/test/ui/noncopyable-class.rs @@ -12,7 +12,7 @@ impl Drop for Bar { fn bar(x:isize) -> Bar { Bar { - x: x + x } } @@ -24,7 +24,7 @@ struct Foo { fn foo(i:isize) -> Foo { Foo { - i: i, + i, j: bar(5) } } diff --git a/src/test/ui/overloaded/overloaded-autoderef-count.rs b/src/test/ui/overloaded/overloaded-autoderef-count.rs index d58deda09f70c..51513aa9023b4 100644 --- a/src/test/ui/overloaded/overloaded-autoderef-count.rs +++ b/src/test/ui/overloaded/overloaded-autoderef-count.rs @@ -14,7 +14,7 @@ impl DerefCounter { DerefCounter { count_imm: Cell::new(0), count_mut: 0, - value: value + value } } diff --git a/src/test/ui/overloaded/overloaded-autoderef-order.rs b/src/test/ui/overloaded/overloaded-autoderef-order.rs index f48bae55f5f1e..4c847902379b2 100644 --- a/src/test/ui/overloaded/overloaded-autoderef-order.rs +++ b/src/test/ui/overloaded/overloaded-autoderef-order.rs @@ -37,8 +37,8 @@ mod priv_test { impl DerefWrapperHideX { pub fn new(x: X, y: Y) -> DerefWrapperHideX { DerefWrapperHideX { - x: x, - y: y + x, + y } } } diff --git a/src/test/ui/overloaded/overloaded-deref-count.rs b/src/test/ui/overloaded/overloaded-deref-count.rs index e2f1e10b5c8ae..8dc946ea2ef09 100644 --- a/src/test/ui/overloaded/overloaded-deref-count.rs +++ b/src/test/ui/overloaded/overloaded-deref-count.rs @@ -15,7 +15,7 @@ impl DerefCounter { DerefCounter { count_imm: Cell::new(0), count_mut: 0, - value: value + value } } diff --git a/src/test/ui/overloaded/overloaded-index-assoc-list.rs b/src/test/ui/overloaded/overloaded-index-assoc-list.rs index eb027afeacde9..c439e185aeec3 100644 --- a/src/test/ui/overloaded/overloaded-index-assoc-list.rs +++ b/src/test/ui/overloaded/overloaded-index-assoc-list.rs @@ -15,7 +15,7 @@ struct AssociationPair { impl AssociationList { fn push(&mut self, key: K, value: V) { - self.pairs.push(AssociationPair {key: key, value: value}); + self.pairs.push(AssociationPair {key, value}); } } diff --git a/src/test/ui/regions/issue-12470.rs b/src/test/ui/regions/issue-12470.rs index 0ade359923a0e..b8b8a4d6ae8cf 100644 --- a/src/test/ui/regions/issue-12470.rs +++ b/src/test/ui/regions/issue-12470.rs @@ -20,7 +20,7 @@ struct A<'a> { } fn make_a<'a>(p: &'a dyn X) -> A<'a> { - A { p: p } + A { p } } fn make_make_a<'a>() -> A<'a> { diff --git a/src/test/ui/regions/regions-glb-free-free.rs b/src/test/ui/regions/regions-glb-free-free.rs index 0370a5192d32d..ccfe323eb6c05 100644 --- a/src/test/ui/regions/regions-glb-free-free.rs +++ b/src/test/ui/regions/regions-glb-free-free.rs @@ -7,7 +7,7 @@ mod argparse { } pub fn flag<'r>(name: &'r str, desc: &'r str) -> Flag<'r> { - Flag { name: name, desc: desc, max_count: 1, value: 0 } + Flag { name, desc, max_count: 1, value: 0 } } impl<'a> Flag<'a> { diff --git a/src/test/ui/regions/regions-trait-variance.rs b/src/test/ui/regions/regions-trait-variance.rs index 9169d457d4051..0535ad4414f9a 100644 --- a/src/test/ui/regions/regions-trait-variance.rs +++ b/src/test/ui/regions/regions-trait-variance.rs @@ -27,7 +27,7 @@ struct A<'r> { } fn make_a(p: &dyn X) -> A { - A{p:p} + A{p} } fn make_make_a<'a>() -> A<'a> { diff --git a/src/test/ui/resource-assign-is-not-copy.rs b/src/test/ui/resource-assign-is-not-copy.rs index c1de139a9a95f..da326eab0e5bd 100644 --- a/src/test/ui/resource-assign-is-not-copy.rs +++ b/src/test/ui/resource-assign-is-not-copy.rs @@ -16,7 +16,7 @@ impl<'a> Drop for r<'a> { fn r(i: &Cell) -> r { r { - i: i + i } } diff --git a/src/test/ui/resource-destruct.rs b/src/test/ui/resource-destruct.rs index c4756a21a0016..3300de093b4f4 100644 --- a/src/test/ui/resource-destruct.rs +++ b/src/test/ui/resource-destruct.rs @@ -19,7 +19,7 @@ impl<'a> shrinky_pointer<'a> { fn shrinky_pointer(i: &Cell) -> shrinky_pointer { shrinky_pointer { - i: i + i } } diff --git a/src/test/ui/self/explicit-self.rs b/src/test/ui/self/explicit-self.rs index 6d19d33b6fee9..64511d5fb17e8 100644 --- a/src/test/ui/self/explicit-self.rs +++ b/src/test/ui/self/explicit-self.rs @@ -49,7 +49,7 @@ struct A { fn thing(x: A) -> thing { thing { - x: x + x } } diff --git a/src/test/ui/span/dropck_direct_cycle_with_drop.rs b/src/test/ui/span/dropck_direct_cycle_with_drop.rs index 14d6e6654746f..a23343acffd51 100644 --- a/src/test/ui/span/dropck_direct_cycle_with_drop.rs +++ b/src/test/ui/span/dropck_direct_cycle_with_drop.rs @@ -21,7 +21,7 @@ struct D<'a> { } impl<'a> D<'a> { - fn new(name: String) -> D<'a> { D { name: name, p: Cell::new(None) } } + fn new(name: String) -> D<'a> { D { name, p: Cell::new(None) } } } impl<'a> Drop for D<'a> { diff --git a/src/test/ui/structs-enums/class-dtor.rs b/src/test/ui/structs-enums/class-dtor.rs index 583a5e2409859..3e4d1174ecaac 100644 --- a/src/test/ui/structs-enums/class-dtor.rs +++ b/src/test/ui/structs-enums/class-dtor.rs @@ -18,7 +18,7 @@ impl Drop for cat { fn cat(done: extern "C" fn(usize)) -> cat { cat { meows: 0, - done: done + done } } diff --git a/src/test/ui/structs-enums/classes-self-referential.rs b/src/test/ui/structs-enums/classes-self-referential.rs index 27d6ebf2c2a39..929538795153a 100644 --- a/src/test/ui/structs-enums/classes-self-referential.rs +++ b/src/test/ui/structs-enums/classes-self-referential.rs @@ -11,7 +11,7 @@ struct kitten { fn kitten(cat: Option) -> kitten { kitten { - cat: cat + cat } } diff --git a/src/test/ui/structs-enums/resource-in-struct.rs b/src/test/ui/structs-enums/resource-in-struct.rs index 35a4b14bc3f87..d5b39d31111b4 100644 --- a/src/test/ui/structs-enums/resource-in-struct.rs +++ b/src/test/ui/structs-enums/resource-in-struct.rs @@ -21,7 +21,7 @@ impl<'a> Drop for close_res<'a> { fn close_res(i: closable) -> close_res { close_res { - i: i + i } } diff --git a/src/test/ui/structs-enums/struct-field-shorthand.rs b/src/test/ui/structs-enums/struct-field-shorthand.rs index ed650c68364c1..dfbc456332842 100644 --- a/src/test/ui/structs-enums/struct-field-shorthand.rs +++ b/src/test/ui/structs-enums/struct-field-shorthand.rs @@ -11,7 +11,7 @@ struct Bar { pub fn main() { let (x, y, z) = (1, true, 2); - let a = Foo { x, y: y, z }; + let a = Foo { x, y, z }; assert_eq!(a.x, x); assert_eq!(a.y, y); assert_eq!(a.z, z); diff --git a/src/test/ui/structs-enums/struct-path-self.rs b/src/test/ui/structs-enums/struct-path-self.rs index e7a59858f570e..4c81f2c714445 100644 --- a/src/test/ui/structs-enums/struct-path-self.rs +++ b/src/test/ui/structs-enums/struct-path-self.rs @@ -14,7 +14,7 @@ impl, U: Default> Tr for S { fn f(&self) -> Self { let s = Self { a: Default::default(), b: Default::default() }; match s { - Self { a, b } => Self { a: a + 1, b: b } + Self { a, b } => Self { a: a + 1, b } } } } @@ -23,7 +23,7 @@ impl> S { fn g(&self) -> Self { let s = Self { a: Default::default(), b: Default::default() }; match s { - Self { a, b } => Self { a: a, b: b + 1 } + Self { a, b } => Self { a, b: b + 1 } } } } diff --git a/src/test/ui/suggestions/issue-84973.rs b/src/test/ui/suggestions/issue-84973.rs index 42468478ed9a2..ae9ebd2a4a536 100644 --- a/src/test/ui/suggestions/issue-84973.rs +++ b/src/test/ui/suggestions/issue-84973.rs @@ -27,7 +27,7 @@ where pub fn new(g: G) -> Self { Other { a: "hi", - g: g, + g, } } } diff --git a/src/test/ui/threads-sendsync/send-resource.rs b/src/test/ui/threads-sendsync/send-resource.rs index 023a84d6b6ec0..4d0616c4e31f3 100644 --- a/src/test/ui/threads-sendsync/send-resource.rs +++ b/src/test/ui/threads-sendsync/send-resource.rs @@ -19,7 +19,7 @@ impl Drop for test { fn test(f: isize) -> test { test { - f: f + f } } diff --git a/src/test/ui/threads-sendsync/sendable-class.rs b/src/test/ui/threads-sendsync/sendable-class.rs index 7facf245bde42..ca06bba52fed7 100644 --- a/src/test/ui/threads-sendsync/sendable-class.rs +++ b/src/test/ui/threads-sendsync/sendable-class.rs @@ -17,8 +17,8 @@ struct foo { fn foo(i:isize, j: char) -> foo { foo { - i: i, - j: j + i, + j } } diff --git a/src/test/ui/threads-sendsync/tls-init-on-init.rs b/src/test/ui/threads-sendsync/tls-init-on-init.rs index 193c18151059a..e5332b1747dd5 100644 --- a/src/test/ui/threads-sendsync/tls-init-on-init.rs +++ b/src/test/ui/threads-sendsync/tls-init-on-init.rs @@ -20,7 +20,7 @@ impl Foo { if cnt == 0 { FOO.with(|_| {}); } - Foo { cnt: cnt } + Foo { cnt } } } diff --git a/src/test/ui/traits/coercion-generic-regions.rs b/src/test/ui/traits/coercion-generic-regions.rs index af478df6dfa99..bde2da40749fc 100644 --- a/src/test/ui/traits/coercion-generic-regions.rs +++ b/src/test/ui/traits/coercion-generic-regions.rs @@ -15,5 +15,5 @@ impl Trait<&'static str> for Struct { fn main() { let person = "Fred".to_string(); let person: &str = &person; //~ ERROR `person` does not live long enough - let s: Box> = Box::new(Struct { person: person }); + let s: Box> = Box::new(Struct { person }); } diff --git a/src/test/ui/traits/coercion-generic-regions.stderr b/src/test/ui/traits/coercion-generic-regions.stderr index 5cfb64901233e..723d8c972feaf 100644 --- a/src/test/ui/traits/coercion-generic-regions.stderr +++ b/src/test/ui/traits/coercion-generic-regions.stderr @@ -6,7 +6,7 @@ LL | let person: &str = &person; | | | borrowed value does not live long enough | assignment requires that `person` is borrowed for `'static` -LL | let s: Box> = Box::new(Struct { person: person }); +LL | let s: Box> = Box::new(Struct { person }); LL | } | - `person` dropped here while still borrowed diff --git a/src/test/ui/type-param-constraints.rs b/src/test/ui/type-param-constraints.rs index 4b42fddaf5c88..de60e7f2658da 100644 --- a/src/test/ui/type-param-constraints.rs +++ b/src/test/ui/type-param-constraints.rs @@ -20,7 +20,7 @@ impl Drop for r { fn r(i:isize) -> r { r { - i: i + i } } diff --git a/src/test/ui/unwind-resource.rs b/src/test/ui/unwind-resource.rs index a063bef0822f2..455c2d3c482ed 100644 --- a/src/test/ui/unwind-resource.rs +++ b/src/test/ui/unwind-resource.rs @@ -21,7 +21,7 @@ impl Drop for complainer { fn complainer(tx: Sender) -> complainer { println!("Hello!"); complainer { - tx: tx + tx } } diff --git a/src/test/ui/variance-intersection-of-ref-and-opt-ref.rs b/src/test/ui/variance-intersection-of-ref-and-opt-ref.rs index 74707a98d325f..16bc6e0ed58bc 100644 --- a/src/test/ui/variance-intersection-of-ref-and-opt-ref.rs +++ b/src/test/ui/variance-intersection-of-ref-and-opt-ref.rs @@ -12,7 +12,7 @@ struct List<'l> { } fn foo(field1: &i32, field2: Option<&i32>) -> i32 { - let list = List { field1: field1, field2: field2 }; + let list = List { field1, field2 }; *list.field1 + list.field2.cloned().unwrap_or(0) } diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs index acc78840bb9e6..ceb194031dd9e 100644 --- a/src/tools/clippy/clippy_lints/src/lib.rs +++ b/src/tools/clippy/clippy_lints/src/lib.rs @@ -321,7 +321,6 @@ mod ranges; mod redundant_clone; mod redundant_closure_call; mod redundant_else; -mod redundant_field_names; mod redundant_pub_crate; mod redundant_slicing; mod redundant_static_lifetimes; @@ -896,7 +895,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: redundant_clone::REDUNDANT_CLONE, redundant_closure_call::REDUNDANT_CLOSURE_CALL, redundant_else::REDUNDANT_ELSE, - redundant_field_names::REDUNDANT_FIELD_NAMES, redundant_pub_crate::REDUNDANT_PUB_CRATE, redundant_slicing::REDUNDANT_SLICING, redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES, @@ -1409,7 +1407,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: LintId::of(ranges::REVERSED_EMPTY_RANGES), LintId::of(redundant_clone::REDUNDANT_CLONE), LintId::of(redundant_closure_call::REDUNDANT_CLOSURE_CALL), - LintId::of(redundant_field_names::REDUNDANT_FIELD_NAMES), LintId::of(redundant_slicing::REDUNDANT_SLICING), LintId::of(redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES), LintId::of(reference::DEREF_ADDROF), @@ -1570,7 +1567,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: LintId::of(ptr_eq::PTR_EQ), LintId::of(question_mark::QUESTION_MARK), LintId::of(ranges::MANUAL_RANGE_CONTAINS), - LintId::of(redundant_field_names::REDUNDANT_FIELD_NAMES), LintId::of(redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES), LintId::of(returns::LET_AND_RETURN), LintId::of(returns::NEEDLESS_RETURN), @@ -1908,7 +1904,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: store.register_early_pass(move || Box::new(manual_non_exhaustive::ManualNonExhaustive::new(msrv))); store.register_late_pass(move || Box::new(manual_strip::ManualStrip::new(msrv))); store.register_early_pass(move || Box::new(redundant_static_lifetimes::RedundantStaticLifetimes::new(msrv))); - store.register_early_pass(move || Box::new(redundant_field_names::RedundantFieldNames::new(msrv))); store.register_late_pass(move || Box::new(checked_conversions::CheckedConversions::new(msrv))); store.register_late_pass(move || Box::new(mem_replace::MemReplace::new(msrv))); store.register_late_pass(move || Box::new(ranges::Ranges::new(msrv))); @@ -1918,7 +1913,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: store.register_late_pass(move || Box::new(needless_question_mark::NeedlessQuestionMark)); store.register_late_pass(move || Box::new(casts::Casts::new(msrv))); store.register_early_pass(move || Box::new(unnested_or_patterns::UnnestedOrPatterns::new(msrv))); - store.register_late_pass(|| Box::new(size_of_in_element_count::SizeOfInElementCount)); store.register_late_pass(|| Box::new(map_clone::MapClone)); store.register_late_pass(|| Box::new(map_err_ignore::MapErrIgnore)); @@ -2210,6 +2204,7 @@ pub fn register_renamed(ls: &mut rustc_lint::LintStore) { ls.register_renamed("clippy::panic_params", "non_fmt_panics"); ls.register_renamed("clippy::unknown_clippy_lints", "unknown_lints"); ls.register_renamed("clippy::invalid_atomic_ordering", "invalid_atomic_ordering"); + ls.register_renamed("clippy::redundant_field_names", "redundant_field_initializers"); } // only exists to let the dogfood integration test works. diff --git a/src/tools/clippy/clippy_lints/src/redundant_field_names.rs b/src/tools/clippy/clippy_lints/src/redundant_field_names.rs deleted file mode 100644 index 47df4917510ff..0000000000000 --- a/src/tools/clippy/clippy_lints/src/redundant_field_names.rs +++ /dev/null @@ -1,85 +0,0 @@ -use clippy_utils::diagnostics::span_lint_and_sugg; -use clippy_utils::{meets_msrv, msrvs}; -use rustc_ast::ast::{Expr, ExprKind}; -use rustc_errors::Applicability; -use rustc_lint::{EarlyContext, EarlyLintPass}; -use rustc_middle::lint::in_external_macro; -use rustc_semver::RustcVersion; -use rustc_session::{declare_tool_lint, impl_lint_pass}; - -declare_clippy_lint! { - /// ### What it does - /// Checks for fields in struct literals where shorthands - /// could be used. - /// - /// ### Why is this bad? - /// If the field and variable names are the same, - /// the field name is redundant. - /// - /// ### Example - /// ```rust - /// let bar: u8 = 123; - /// - /// struct Foo { - /// bar: u8, - /// } - /// - /// let foo = Foo { bar: bar }; - /// ``` - /// the last line can be simplified to - /// ```ignore - /// let foo = Foo { bar }; - /// ``` - pub REDUNDANT_FIELD_NAMES, - style, - "checks for fields in struct literals where shorthands could be used" -} - -pub struct RedundantFieldNames { - msrv: Option, -} - -impl RedundantFieldNames { - #[must_use] - pub fn new(msrv: Option) -> Self { - Self { msrv } - } -} - -impl_lint_pass!(RedundantFieldNames => [REDUNDANT_FIELD_NAMES]); - -impl EarlyLintPass for RedundantFieldNames { - fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) { - if !meets_msrv(self.msrv.as_ref(), &msrvs::FIELD_INIT_SHORTHAND) { - return; - } - - if in_external_macro(cx.sess, expr.span) { - return; - } - if let ExprKind::Struct(ref se) = expr.kind { - for field in &se.fields { - if field.is_shorthand { - continue; - } - if let ExprKind::Path(None, path) = &field.expr.kind { - if path.segments.len() == 1 - && path.segments[0].ident == field.ident - && path.segments[0].args.is_none() - { - span_lint_and_sugg( - cx, - REDUNDANT_FIELD_NAMES, - field.span, - "redundant field names in struct initialization", - "replace it with", - field.ident.to_string(), - Applicability::MachineApplicable, - ); - } - } - } - } - } - extract_msrv_attr!(EarlyContext); -} diff --git a/src/tools/clippy/clippy_lints/src/utils/conf.rs b/src/tools/clippy/clippy_lints/src/utils/conf.rs index 8651fa6fcf9ea..ddaad6cb9aa5b 100644 --- a/src/tools/clippy/clippy_lints/src/utils/conf.rs +++ b/src/tools/clippy/clippy_lints/src/utils/conf.rs @@ -132,7 +132,7 @@ define_Conf! { /// /// Suppress lints whenever the suggested change would cause breakage for other crates. (avoid_breaking_exported_api: bool = true), - /// Lint: MANUAL_SPLIT_ONCE, MANUAL_STR_REPEAT, CLONED_INSTEAD_OF_COPIED, REDUNDANT_FIELD_NAMES, REDUNDANT_STATIC_LIFETIMES, FILTER_MAP_NEXT, CHECKED_CONVERSIONS, MANUAL_RANGE_CONTAINS, USE_SELF, MEM_REPLACE_WITH_DEFAULT, MANUAL_NON_EXHAUSTIVE, OPTION_AS_REF_DEREF, MAP_UNWRAP_OR, MATCH_LIKE_MATCHES_MACRO, MANUAL_STRIP, MISSING_CONST_FOR_FN, UNNESTED_OR_PATTERNS, FROM_OVER_INTO, PTR_AS_PTR, IF_THEN_SOME_ELSE_NONE, APPROX_CONSTANT. + /// Lint: MANUAL_SPLIT_ONCE, MANUAL_STR_REPEAT, CLONED_INSTEAD_OF_COPIED, REDUNDANT_STATIC_LIFETIMES, FILTER_MAP_NEXT, CHECKED_CONVERSIONS, MANUAL_RANGE_CONTAINS, USE_SELF, MEM_REPLACE_WITH_DEFAULT, MANUAL_NON_EXHAUSTIVE, OPTION_AS_REF_DEREF, MAP_UNWRAP_OR, MATCH_LIKE_MATCHES_MACRO, MANUAL_STRIP, MISSING_CONST_FOR_FN, UNNESTED_OR_PATTERNS, FROM_OVER_INTO, PTR_AS_PTR, IF_THEN_SOME_ELSE_NONE, APPROX_CONSTANT. /// /// The minimum rust version that the project supports (msrv: Option = None), diff --git a/src/tools/clippy/tests/ui/inconsistent_struct_constructor.fixed b/src/tools/clippy/tests/ui/inconsistent_struct_constructor.fixed index d1025743790a9..16777ffd6a76e 100644 --- a/src/tools/clippy/tests/ui/inconsistent_struct_constructor.fixed +++ b/src/tools/clippy/tests/ui/inconsistent_struct_constructor.fixed @@ -1,7 +1,7 @@ // run-rustfix // edition:2018 #![warn(clippy::inconsistent_struct_constructor)] -#![allow(clippy::redundant_field_names)] +#![allow(redundant_field_initializers)] #![allow(clippy::unnecessary_operation)] #![allow(clippy::no_effect)] #![allow(dead_code)] diff --git a/src/tools/clippy/tests/ui/inconsistent_struct_constructor.rs b/src/tools/clippy/tests/ui/inconsistent_struct_constructor.rs index b095aa64a2174..6a25c04b99a37 100644 --- a/src/tools/clippy/tests/ui/inconsistent_struct_constructor.rs +++ b/src/tools/clippy/tests/ui/inconsistent_struct_constructor.rs @@ -1,7 +1,7 @@ // run-rustfix // edition:2018 #![warn(clippy::inconsistent_struct_constructor)] -#![allow(clippy::redundant_field_names)] +#![allow(redundant_field_initializers)] #![allow(clippy::unnecessary_operation)] #![allow(clippy::no_effect)] #![allow(dead_code)] diff --git a/src/tools/clippy/tests/ui/min_rust_version_attr.rs b/src/tools/clippy/tests/ui/min_rust_version_attr.rs index 8d9fc5a864d75..7e027eb7a4d6e 100644 --- a/src/tools/clippy/tests/ui/min_rust_version_attr.rs +++ b/src/tools/clippy/tests/ui/min_rust_version_attr.rs @@ -51,11 +51,6 @@ pub fn manual_strip_msrv() { } } -pub fn redundant_fieldnames() { - let start = 0; - let _ = RangeFrom { start: start }; -} - pub fn redundant_static_lifetime() { const VAR_ONE: &'static str = "Test constant #1"; } @@ -140,7 +135,6 @@ fn unnest_or_patterns() { fn main() { filter_map_next(); checked_conversion(); - redundant_fieldnames(); redundant_static_lifetime(); option_as_ref_deref(); match_like_matches(); diff --git a/src/tools/clippy/tests/ui/min_rust_version_attr.stderr b/src/tools/clippy/tests/ui/min_rust_version_attr.stderr index 360dcfb230c65..c33061d5dd55b 100644 --- a/src/tools/clippy/tests/ui/min_rust_version_attr.stderr +++ b/src/tools/clippy/tests/ui/min_rust_version_attr.stderr @@ -1,12 +1,12 @@ error: stripping a prefix manually - --> $DIR/min_rust_version_attr.rs:165:24 + --> $DIR/min_rust_version_attr.rs:159:24 | LL | assert_eq!(s["hello, ".len()..].to_uppercase(), "WORLD!"); | ^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::manual-strip` implied by `-D warnings` note: the prefix was tested here - --> $DIR/min_rust_version_attr.rs:164:9 + --> $DIR/min_rust_version_attr.rs:158:9 | LL | if s.starts_with("hello, ") { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,13 +17,13 @@ LL ~ assert_eq!(.to_uppercase(), "WORLD!"); | error: stripping a prefix manually - --> $DIR/min_rust_version_attr.rs:177:24 + --> $DIR/min_rust_version_attr.rs:171:24 | LL | assert_eq!(s["hello, ".len()..].to_uppercase(), "WORLD!"); | ^^^^^^^^^^^^^^^^^^^^ | note: the prefix was tested here - --> $DIR/min_rust_version_attr.rs:176:9 + --> $DIR/min_rust_version_attr.rs:170:9 | LL | if s.starts_with("hello, ") { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/tools/clippy/tests/ui/no_effect.rs b/src/tools/clippy/tests/ui/no_effect.rs index 7ec845adfaacf..df4a19eba21eb 100644 --- a/src/tools/clippy/tests/ui/no_effect.rs +++ b/src/tools/clippy/tests/ui/no_effect.rs @@ -3,7 +3,7 @@ #![allow(dead_code)] #![allow(path_statements)] #![allow(clippy::deref_addrof)] -#![allow(clippy::redundant_field_names)] +#![allow(redundant_field_initializers)] #![feature(untagged_unions)] struct Unit; diff --git a/src/tools/clippy/tests/ui/trivially_copy_pass_by_ref.rs b/src/tools/clippy/tests/ui/trivially_copy_pass_by_ref.rs index 1a0123803a3ee..cb558ecd4f4d1 100644 --- a/src/tools/clippy/tests/ui/trivially_copy_pass_by_ref.rs +++ b/src/tools/clippy/tests/ui/trivially_copy_pass_by_ref.rs @@ -5,7 +5,7 @@ #![allow( clippy::many_single_char_names, clippy::blacklisted_name, - clippy::redundant_field_names + redundant_field_initializers )] #[derive(Copy, Clone)]