From eca11b99a7d25e4e6573472a16537c1aacb5d5e1 Mon Sep 17 00:00:00 2001 From: teresy Date: Tue, 6 Nov 2018 15:05:44 -0500 Subject: [PATCH] refactor: use shorthand fields --- src/liballoc/string.rs | 2 +- src/libpanic_unwind/dwarf/mod.rs | 2 +- src/libpanic_unwind/seh64_gnu.rs | 2 +- src/librustc/infer/resolve.rs | 4 ++-- src/librustc/infer/type_variable.rs | 2 +- src/librustc/infer/unify_key.rs | 2 +- src/librustc/middle/stability.rs | 2 +- src/librustc/mir/mod.rs | 2 +- src/librustc/mir/tcx.rs | 2 +- src/librustc/traits/project.rs | 2 +- src/librustc/traits/select.rs | 2 +- src/librustc/ty/_match.rs | 2 +- src/librustc/ty/fold.rs | 2 +- src/librustc_codegen_llvm/llvm/mod.rs | 2 +- src/librustc_codegen_llvm/mir/analyze.rs | 2 +- src/librustc_codegen_utils/symbol_names_test.rs | 2 +- src/librustc_data_structures/flock.rs | 2 +- src/librustc_data_structures/svh.rs | 2 +- src/librustc_lint/types.rs | 2 +- src/librustc_metadata/encoder.rs | 2 +- src/librustc_mir/build/scope.rs | 4 ++-- src/librustc_mir/dataflow/impls/borrowed_locals.rs | 2 +- src/librustc_mir/dataflow/impls/storage_liveness.rs | 2 +- src/librustc_mir/hair/pattern/check_match.rs | 2 +- src/librustc_mir/hair/pattern/mod.rs | 6 +++--- src/librustc_mir/transform/elaborate_drops.rs | 2 +- src/librustc_mir/transform/simplify.rs | 2 +- src/librustc_mir/transform/simplify_branches.rs | 2 +- src/librustc_passes/ast_validation.rs | 2 +- src/librustc_resolve/lib.rs | 4 ++-- src/librustc_save_analysis/json_dumper.rs | 2 +- src/librustc_typeck/check/wfcheck.rs | 2 +- src/librustc_typeck/coherence/orphan.rs | 2 +- src/librustc_typeck/coherence/unsafety.rs | 2 +- src/librustc_typeck/collect.rs | 2 +- src/librustc_typeck/impl_wf_check.rs | 2 +- src/librustdoc/clean/mod.rs | 2 +- src/libstd/collections/hash/map.rs | 2 +- src/libstd/fs.rs | 2 +- src/libstd/io/util.rs | 2 +- src/libstd/sync/mpsc/mod.rs | 2 +- src/libstd/sys/cloudabi/time.rs | 4 ++-- src/libstd/sys/redox/fd.rs | 2 +- src/libstd/sys/redox/fs.rs | 2 +- src/libstd/sys/redox/syscall/error.rs | 2 +- src/libstd/sys/redox/thread.rs | 2 +- src/libstd/sys/redox/time.rs | 2 +- src/libstd/sys/unix/fd.rs | 2 +- src/libstd/sys/unix/fs.rs | 8 ++++---- src/libstd/sys/unix/time.rs | 4 ++-- src/libstd/sys/windows/process.rs | 2 +- src/libstd/sys/windows/time.rs | 2 +- src/libstd/sys_common/poison.rs | 2 +- src/libstd/sys_common/wtf8.rs | 4 ++-- src/libsyntax/ext/source_util.rs | 2 +- src/libsyntax/fold.rs | 2 +- src/libsyntax/parse/parser.rs | 2 +- 57 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index ab3f8fc2707..0dffbd9a4c3 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -502,7 +502,7 @@ impl String { #[stable(feature = "rust1", since = "1.0.0")] pub fn from_utf8(vec: Vec) -> Result { match str::from_utf8(&vec) { - Ok(..) => Ok(String { vec: vec }), + Ok(..) => Ok(String { vec }), Err(e) => { Err(FromUtf8Error { bytes: vec, diff --git a/src/libpanic_unwind/dwarf/mod.rs b/src/libpanic_unwind/dwarf/mod.rs index 7e0c32fe03d..3ff250ff659 100644 --- a/src/libpanic_unwind/dwarf/mod.rs +++ b/src/libpanic_unwind/dwarf/mod.rs @@ -29,7 +29,7 @@ struct Unaligned(T); impl DwarfReader { pub fn new(ptr: *const u8) -> DwarfReader { - DwarfReader { ptr: ptr } + DwarfReader { ptr } } // DWARF streams are packed, so e.g. a u32 would not necessarily be aligned diff --git a/src/libpanic_unwind/seh64_gnu.rs b/src/libpanic_unwind/seh64_gnu.rs index c2074db0038..60e9829ef9e 100644 --- a/src/libpanic_unwind/seh64_gnu.rs +++ b/src/libpanic_unwind/seh64_gnu.rs @@ -41,7 +41,7 @@ struct PanicData { } pub unsafe fn panic(data: Box) -> u32 { - let panic_ctx = Box::new(PanicData { data: data }); + let panic_ctx = Box::new(PanicData { data }); let params = [Box::into_raw(panic_ctx) as c::ULONG_PTR]; c::RaiseException(RUST_PANIC, c::EXCEPTION_NONCONTINUABLE, diff --git a/src/librustc/infer/resolve.rs b/src/librustc/infer/resolve.rs index 0ef97618572..a0c310ac276 100644 --- a/src/librustc/infer/resolve.rs +++ b/src/librustc/infer/resolve.rs @@ -26,7 +26,7 @@ pub struct OpportunisticTypeResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> OpportunisticTypeResolver<'a, 'gcx, 'tcx> { pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self { - OpportunisticTypeResolver { infcx: infcx } + OpportunisticTypeResolver { infcx } } } @@ -54,7 +54,7 @@ pub struct OpportunisticTypeAndRegionResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> OpportunisticTypeAndRegionResolver<'a, 'gcx, 'tcx> { pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self { - OpportunisticTypeAndRegionResolver { infcx: infcx } + OpportunisticTypeAndRegionResolver { infcx } } } diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs index 970b6e096ff..39bf59a7a4e 100644 --- a/src/librustc/infer/type_variable.rs +++ b/src/librustc/infer/type_variable.rs @@ -169,7 +169,7 @@ impl<'tcx> TypeVariableTable<'tcx> { // Hack: we only need this so that `types_escaping_snapshot` // can see what has been unified; see the Delegate impl for // more details. - self.values.record(Instantiate { vid: vid }); + self.values.record(Instantiate { vid }); } /// Creates a new type variable. diff --git a/src/librustc/infer/unify_key.rs b/src/librustc/infer/unify_key.rs index cdc92877a5a..f8001e085c4 100644 --- a/src/librustc/infer/unify_key.rs +++ b/src/librustc/infer/unify_key.rs @@ -43,7 +43,7 @@ impl UnifyValue for RegionVidKey { value2.min_vid }; - Ok(RegionVidKey { min_vid: min_vid }) + Ok(RegionVidKey { min_vid }) } } diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 9dd13dd2272..30e1d49c445 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -469,7 +469,7 @@ impl<'a, 'tcx> Index<'tcx> { /// Cross-references the feature names of unstable APIs with enabled /// features and possibly prints errors. pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - let mut checker = Checker { tcx: tcx }; + let mut checker = Checker { tcx }; tcx.hir.krate().visit_all_item_likes(&mut checker.as_deep_visitor()); } diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 9a0623ca539..a7a3c0afb08 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -2871,7 +2871,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> { use mir::TerminatorKind::*; let kind = match self.kind { - Goto { target } => Goto { target: target }, + Goto { target } => Goto { target }, SwitchInt { ref discr, switch_ty, diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs index fc7b4862b0a..0fa37609f34 100644 --- a/src/librustc/mir/tcx.rs +++ b/src/librustc/mir/tcx.rs @@ -32,7 +32,7 @@ pub enum PlaceTy<'tcx> { impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> { pub fn from_ty(ty: Ty<'tcx>) -> PlaceTy<'tcx> { - PlaceTy::Ty { ty: ty } + PlaceTy::Ty { ty } } pub fn to_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> { diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index 7c1f87fbf3f..6d2b545f1b0 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -269,7 +269,7 @@ fn project_and_unify_type<'cx, 'gcx, 'tcx>( }, Err(err) => { debug!("project_and_unify_type: equating types encountered error {:?}", err); - Err(MismatchedProjectionTypes { err: err }) + Err(MismatchedProjectionTypes { err }) } } } diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 156a27a7d0a..a4a5efad1f5 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -3434,7 +3434,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { _ => bug!(), }; - Ok(VtableBuiltinData { nested: nested }) + Ok(VtableBuiltinData { nested }) } /////////////////////////////////////////////////////////////////////////// diff --git a/src/librustc/ty/_match.rs b/src/librustc/ty/_match.rs index c9b0e97c9b0..d20b6d36199 100644 --- a/src/librustc/ty/_match.rs +++ b/src/librustc/ty/_match.rs @@ -34,7 +34,7 @@ pub struct Match<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> Match<'a, 'gcx, 'tcx> { pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Match<'a, 'gcx, 'tcx> { - Match { tcx: tcx } + Match { tcx } } } diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index f54dcfa37e9..329abe609b5 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -82,7 +82,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone { } fn has_type_flags(&self, flags: TypeFlags) -> bool { - self.visit_with(&mut HasTypeFlagsVisitor { flags: flags }) + self.visit_with(&mut HasTypeFlagsVisitor { flags }) } fn has_projections(&self) -> bool { self.has_type_flags(TypeFlags::HAS_PROJECTION) diff --git a/src/librustc_codegen_llvm/llvm/mod.rs b/src/librustc_codegen_llvm/llvm/mod.rs index 4343c8c184e..fbd5192a63f 100644 --- a/src/librustc_codegen_llvm/llvm/mod.rs +++ b/src/librustc_codegen_llvm/llvm/mod.rs @@ -190,7 +190,7 @@ impl ObjectFile { pub fn new(llmb: &'static mut MemoryBuffer) -> Option { unsafe { let llof = LLVMCreateObjectFile(llmb)?; - Some(ObjectFile { llof: llof }) + Some(ObjectFile { llof }) } } } diff --git a/src/librustc_codegen_llvm/mir/analyze.rs b/src/librustc_codegen_llvm/mir/analyze.rs index a0d6cc46295..aad08550d97 100644 --- a/src/librustc_codegen_llvm/mir/analyze.rs +++ b/src/librustc_codegen_llvm/mir/analyze.rs @@ -328,7 +328,7 @@ pub fn cleanup_kinds<'a, 'tcx>(mir: &mir::Mir<'tcx>) -> IndexVec { - result[succ] = CleanupKind::Internal { funclet: funclet }; + result[succ] = CleanupKind::Internal { funclet }; } CleanupKind::Funclet => { if funclet != succ { diff --git a/src/librustc_codegen_utils/symbol_names_test.rs b/src/librustc_codegen_utils/symbol_names_test.rs index 47bbd67fb5c..6eaf0c1c08d 100644 --- a/src/librustc_codegen_utils/symbol_names_test.rs +++ b/src/librustc_codegen_utils/symbol_names_test.rs @@ -32,7 +32,7 @@ pub fn report_symbol_names<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { } tcx.dep_graph.with_ignore(|| { - let mut visitor = SymbolNamesTest { tcx: tcx }; + let mut visitor = SymbolNamesTest { tcx }; tcx.hir.krate().visit_all_item_likes(&mut visitor); }) } diff --git a/src/librustc_data_structures/flock.rs b/src/librustc_data_structures/flock.rs index 38ce331051f..86e48e21626 100644 --- a/src/librustc_data_structures/flock.rs +++ b/src/librustc_data_structures/flock.rs @@ -214,7 +214,7 @@ cfg_if! { unsafe { libc::close(fd); } Err(err) } else { - Ok(Lock { fd: fd }) + Ok(Lock { fd }) } } } diff --git a/src/librustc_data_structures/svh.rs b/src/librustc_data_structures/svh.rs index 94f132562b5..3d17824608c 100644 --- a/src/librustc_data_structures/svh.rs +++ b/src/librustc_data_structures/svh.rs @@ -31,7 +31,7 @@ impl Svh { /// compute the SVH from some HIR, you want the `calculate_svh` /// function found in `librustc_incremental`. pub fn new(hash: u64) -> Svh { - Svh { hash: hash } + Svh { hash } } pub fn as_u64(&self) -> u64 { diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index a441f7a87f7..af32218fe20 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -794,7 +794,7 @@ impl LintPass for ImproperCTypes { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImproperCTypes { fn check_foreign_item(&mut self, cx: &LateContext, it: &hir::ForeignItem) { - let mut vis = ImproperCTypesVisitor { cx: cx }; + let mut vis = ImproperCTypesVisitor { cx }; let abi = cx.tcx.hir.get_foreign_abi(it.id); if abi != Abi::RustIntrinsic && abi != Abi::PlatformIntrinsic { match it.node { diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index c36ae02ab54..153dbf3b4c5 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -323,7 +323,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { index.record(DefId::local(CRATE_DEF_INDEX), IsolatedEncoder::encode_info_for_mod, FromId(CRATE_NODE_ID, (&krate.module, &krate.attrs, &vis))); - let mut visitor = EncodeVisitor { index: index }; + let mut visitor = EncodeVisitor { index }; krate.visit_all_item_likes(&mut visitor.as_deep_visitor()); for macro_def in &krate.exported_macros { visitor.visit_macro_def(macro_def); diff --git a/src/librustc_mir/build/scope.rs b/src/librustc_mir/build/scope.rs index cc5b08f2a90..c62188e7ac9 100644 --- a/src/librustc_mir/build/scope.rs +++ b/src/librustc_mir/build/scope.rs @@ -453,7 +453,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } let scope = &self.scopes[len - scope_count]; self.cfg.terminate(block, scope.source_info(span), - TerminatorKind::Goto { target: target }); + TerminatorKind::Goto { target }); } /// Creates a path that performs all required cleanup for dropping a generator. @@ -1019,7 +1019,7 @@ fn build_diverge_scope<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, } else { let block = cfg.start_new_cleanup_block(); cfg.push_end_region(tcx, block, source_info(span), scope.region_scope); - cfg.terminate(block, source_info(span), TerminatorKind::Goto { target: target }); + cfg.terminate(block, source_info(span), TerminatorKind::Goto { target }); *cached_block = Some(block); block } diff --git a/src/librustc_mir/dataflow/impls/borrowed_locals.rs b/src/librustc_mir/dataflow/impls/borrowed_locals.rs index 8d186597b14..1e279d8dd97 100644 --- a/src/librustc_mir/dataflow/impls/borrowed_locals.rs +++ b/src/librustc_mir/dataflow/impls/borrowed_locals.rs @@ -28,7 +28,7 @@ pub struct HaveBeenBorrowedLocals<'a, 'tcx: 'a> { impl<'a, 'tcx: 'a> HaveBeenBorrowedLocals<'a, 'tcx> { pub fn new(mir: &'a Mir<'tcx>) -> Self { - HaveBeenBorrowedLocals { mir: mir } + HaveBeenBorrowedLocals { mir } } pub fn mir(&self) -> &Mir<'tcx> { diff --git a/src/librustc_mir/dataflow/impls/storage_liveness.rs b/src/librustc_mir/dataflow/impls/storage_liveness.rs index ab03ace23d7..c8faa34df8a 100644 --- a/src/librustc_mir/dataflow/impls/storage_liveness.rs +++ b/src/librustc_mir/dataflow/impls/storage_liveness.rs @@ -21,7 +21,7 @@ pub struct MaybeStorageLive<'a, 'tcx: 'a> { impl<'a, 'tcx: 'a> MaybeStorageLive<'a, 'tcx> { pub fn new(mir: &'a Mir<'tcx>) -> Self { - MaybeStorageLive { mir: mir } + MaybeStorageLive { mir } } pub fn mir(&self) -> &Mir<'tcx> { diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index f2ae5774da8..9f99f0362e7 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -52,7 +52,7 @@ impl<'a, 'tcx> Visitor<'tcx> for OuterVisitor<'a, 'tcx> { } pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - tcx.hir.krate().visit_all_item_likes(&mut OuterVisitor { tcx: tcx }.as_deep_visitor()); + tcx.hir.krate().visit_all_item_likes(&mut OuterVisitor { tcx }.as_deep_visitor()); tcx.sess.abort_if_errors(); } diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index cb974366a30..d70b274322b 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -459,7 +459,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { }) .collect(); - PatternKind::Leaf { subpatterns: subpatterns } + PatternKind::Leaf { subpatterns } } ty::Error => { // Avoid ICE (#50577) return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) }; @@ -666,13 +666,13 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { subpatterns, } } else { - PatternKind::Leaf { subpatterns: subpatterns } + PatternKind::Leaf { subpatterns } } } Def::Struct(..) | Def::StructCtor(..) | Def::Union(..) | Def::TyAlias(..) | Def::AssociatedTy(..) | Def::SelfTy(..) | Def::SelfCtor(..) => { - PatternKind::Leaf { subpatterns: subpatterns } + PatternKind::Leaf { subpatterns } } _ => { diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 9d77289d7b9..f3d0d0520c7 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -495,7 +495,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { let target = self.patch.new_block(BasicBlockData { statements: vec![assign], terminator: Some(Terminator { - kind: TerminatorKind::Goto { target: target }, + kind: TerminatorKind::Goto { target }, ..*terminator }), is_cleanup: false, diff --git a/src/librustc_mir/transform/simplify.rs b/src/librustc_mir/transform/simplify.rs index a6e0932bf0a..a624b05bbbe 100644 --- a/src/librustc_mir/transform/simplify.rs +++ b/src/librustc_mir/transform/simplify.rs @@ -302,7 +302,7 @@ impl MirPass for SimplifyLocals { let map = make_local_map(&mut mir.local_decls, marker.locals); // Update references to all vars and tmps now - LocalUpdater { map: map }.visit_mir(mir); + LocalUpdater { map }.visit_mir(mir); mir.local_decls.shrink_to_fit(); } } diff --git a/src/librustc_mir/transform/simplify_branches.rs b/src/librustc_mir/transform/simplify_branches.rs index e14941b8aeb..b2489809543 100644 --- a/src/librustc_mir/transform/simplify_branches.rs +++ b/src/librustc_mir/transform/simplify_branches.rs @@ -57,7 +57,7 @@ impl MirPass for SimplifyBranches { TerminatorKind::Assert { target, cond: Operand::Constant(ref c), expected, .. } if (c.literal.assert_bool(tcx) == Some(true)) == expected => { - TerminatorKind::Goto { target: target } + TerminatorKind::Goto { target } }, TerminatorKind::FalseEdges { real_target, .. } => { TerminatorKind::Goto { target: real_target } diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index f6ace57f5e0..89d5465e601 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -691,5 +691,5 @@ pub fn check_crate(session: &Session, krate: &Crate) { is_banned: false, }, krate); - visit::walk_crate(&mut AstValidator { session: session }, krate) + visit::walk_crate(&mut AstValidator { session }, krate) } diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 86fe584dc3a..94568989ef3 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -4424,7 +4424,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { // declared as public (due to pruning, we don't explore // outside crate private modules => no need to check this) if !in_module_is_extern || name_binding.vis == ty::Visibility::Public { - candidates.push(ImportSuggestion { path: path }); + candidates.push(ImportSuggestion { path }); } } } @@ -4533,7 +4533,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { span: name_binding.span, segments: path_segments, }; - result = Some((module, ImportSuggestion { path: path })); + result = Some((module, ImportSuggestion { path })); } else { // add the module to the lookup if seen_modules.insert(module.def_id().unwrap()) { diff --git a/src/librustc_save_analysis/json_dumper.rs b/src/librustc_save_analysis/json_dumper.rs index e14ac73ee10..53ec6707095 100644 --- a/src/librustc_save_analysis/json_dumper.rs +++ b/src/librustc_save_analysis/json_dumper.rs @@ -71,7 +71,7 @@ impl<'b> JsonDumper> { config: Config, ) -> JsonDumper> { JsonDumper { - output: CallbackOutput { callback: callback }, + output: CallbackOutput { callback }, config: config.clone(), result: Analysis::new(config), } diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index cc1906d91d4..d40b2f1833a 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -962,7 +962,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { AdtField { ty: field_ty, span: field.span } }) .collect(); - AdtVariant { fields: fields } + AdtVariant { fields } } fn enum_variants(&self, enum_def: &hir::EnumDef) -> Vec> { diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index b155587dddc..14c6864434f 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -17,7 +17,7 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir; pub fn check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - let mut orphan = OrphanChecker { tcx: tcx }; + let mut orphan = OrphanChecker { tcx }; tcx.hir.krate().visit_all_item_likes(&mut orphan); } diff --git a/src/librustc_typeck/coherence/unsafety.rs b/src/librustc_typeck/coherence/unsafety.rs index bdbf93ddec2..0894c1d49e8 100644 --- a/src/librustc_typeck/coherence/unsafety.rs +++ b/src/librustc_typeck/coherence/unsafety.rs @@ -16,7 +16,7 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir::{self, Unsafety}; pub fn check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - let mut unsafety = UnsafetyChecker { tcx: tcx }; + let mut unsafety = UnsafetyChecker { tcx }; tcx.hir.krate().visit_all_item_likes(&mut unsafety); } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index f96c85ae7ae..3cefe302ac4 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -62,7 +62,7 @@ use std::iter; // Main entry point pub fn collect_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - let mut visitor = CollectItemTypesVisitor { tcx: tcx }; + let mut visitor = CollectItemTypesVisitor { tcx }; tcx.hir .krate() .visit_all_item_likes(&mut visitor.as_deep_visitor()); diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index 7e0a8d63e28..b79d1279e3d 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -62,7 +62,7 @@ pub fn impl_wf_check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { // We will tag this as part of the WF check -- logically, it is, // but it's one that we must perform earlier than the rest of // WfCheck. - tcx.hir.krate().visit_all_item_likes(&mut ImplWfCheck { tcx: tcx }); + tcx.hir.krate().visit_all_item_likes(&mut ImplWfCheck { tcx }); } struct ImplWfCheck<'a, 'tcx: 'a> { diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 2ba1f103971..88e4ebeb39e 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2959,7 +2959,7 @@ impl<'tcx> Clean for ty::VariantDef { source: cx.tcx.def_span(self.did).clean(cx), visibility: Some(Inherited), def_id: self.did, - inner: VariantItem(Variant { kind: kind }), + inner: VariantItem(Variant { kind }), stability: get_stability(cx, self.did), deprecation: get_deprecation(cx, self.did), } diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index ef5dae724b2..04e1632460b 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -2854,7 +2854,7 @@ mod test_map { slot.borrow_mut()[k] += 1; }); - Droppable { k: k } + Droppable { k } } } diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 017949291bc..c2ced266294 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -877,7 +877,7 @@ impl OpenOptions { fn _open(&self, path: &Path) -> io::Result { let inner = fs_imp::File::open(path, &self.0)?; - Ok(File { inner: inner }) + Ok(File { inner }) } } diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index 371e5b21c13..12995d08683 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -150,7 +150,7 @@ pub struct Repeat { byte: u8 } /// assert_eq!(buffer, [0b101, 0b101, 0b101]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] -pub fn repeat(byte: u8) -> Repeat { Repeat { byte: byte } } +pub fn repeat(byte: u8) -> Repeat { Repeat { byte } } #[stable(feature = "rust1", since = "1.0.0")] impl Read for Repeat { diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 59cf741487e..81f98a55c11 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -931,7 +931,7 @@ impl fmt::Debug for Sender { impl SyncSender { fn new(inner: Arc>) -> SyncSender { - SyncSender { inner: inner } + SyncSender { inner } } /// Sends a value on this synchronous channel. diff --git a/src/libstd/sys/cloudabi/time.rs b/src/libstd/sys/cloudabi/time.rs index ee12731619a..3d66998b9f5 100644 --- a/src/libstd/sys/cloudabi/time.rs +++ b/src/libstd/sys/cloudabi/time.rs @@ -32,7 +32,7 @@ impl Instant { let mut t = mem::uninitialized(); let ret = abi::clock_time_get(abi::clockid::MONOTONIC, 0, &mut t); assert_eq!(ret, abi::errno::SUCCESS); - Instant { t: t } + Instant { t } } } @@ -71,7 +71,7 @@ impl SystemTime { let mut t = mem::uninitialized(); let ret = abi::clock_time_get(abi::clockid::REALTIME, 0, &mut t); assert_eq!(ret, abi::errno::SUCCESS); - SystemTime { t: t } + SystemTime { t } } } diff --git a/src/libstd/sys/redox/fd.rs b/src/libstd/sys/redox/fd.rs index e04e2791b23..d61103a872f 100644 --- a/src/libstd/sys/redox/fd.rs +++ b/src/libstd/sys/redox/fd.rs @@ -21,7 +21,7 @@ pub struct FileDesc { impl FileDesc { pub fn new(fd: usize) -> FileDesc { - FileDesc { fd: fd } + FileDesc { fd } } pub fn raw(&self) -> usize { self.fd } diff --git a/src/libstd/sys/redox/fs.rs b/src/libstd/sys/redox/fs.rs index 2e2216186f1..6059406997d 100644 --- a/src/libstd/sys/redox/fs.rs +++ b/src/libstd/sys/redox/fs.rs @@ -264,7 +264,7 @@ impl File { pub fn file_attr(&self) -> io::Result { let mut stat = syscall::Stat::default(); cvt(syscall::fstat(self.0.raw(), &mut stat))?; - Ok(FileAttr { stat: stat }) + Ok(FileAttr { stat }) } pub fn fsync(&self) -> io::Result<()> { diff --git a/src/libstd/sys/redox/syscall/error.rs b/src/libstd/sys/redox/syscall/error.rs index 1ef79547431..1e378370553 100644 --- a/src/libstd/sys/redox/syscall/error.rs +++ b/src/libstd/sys/redox/syscall/error.rs @@ -19,7 +19,7 @@ pub type Result = result::Result; impl Error { pub fn new(errno: i32) -> Error { - Error { errno: errno } + Error { errno } } pub fn mux(result: Result) -> usize { diff --git a/src/libstd/sys/redox/thread.rs b/src/libstd/sys/redox/thread.rs index f4177087d77..bab91b16e6c 100644 --- a/src/libstd/sys/redox/thread.rs +++ b/src/libstd/sys/redox/thread.rs @@ -38,7 +38,7 @@ impl Thread { panic!("thread failed to exit"); } else { mem::forget(p); - Ok(Thread { id: id }) + Ok(Thread { id }) } } diff --git a/src/libstd/sys/redox/time.rs b/src/libstd/sys/redox/time.rs index 5c491115c55..aac6d2704e7 100644 --- a/src/libstd/sys/redox/time.rs +++ b/src/libstd/sys/redox/time.rs @@ -187,7 +187,7 @@ impl SystemTime { impl From for SystemTime { fn from(t: syscall::TimeSpec) -> SystemTime { - SystemTime { t: Timespec { t: t } } + SystemTime { t: Timespec { t } } } } diff --git a/src/libstd/sys/unix/fd.rs b/src/libstd/sys/unix/fd.rs index db2ea6b660a..af33d2636fb 100644 --- a/src/libstd/sys/unix/fd.rs +++ b/src/libstd/sys/unix/fd.rs @@ -41,7 +41,7 @@ fn max_len() -> usize { impl FileDesc { pub fn new(fd: c_int) -> FileDesc { - FileDesc { fd: fd } + FileDesc { fd } } pub fn raw(&self) -> c_int { self.fd } diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 1d5b0cfa94a..add06aec11b 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -317,7 +317,7 @@ impl DirEntry { cvt(unsafe { fstatat64(fd, self.entry.d_name.as_ptr(), &mut stat, libc::AT_SYMLINK_NOFOLLOW) })?; - Ok(FileAttr { stat: stat }) + Ok(FileAttr { stat }) } #[cfg(not(any(target_os = "linux", target_os = "emscripten", target_os = "android")))] @@ -526,7 +526,7 @@ impl File { cvt(unsafe { fstat64(self.0.raw(), &mut stat) })?; - Ok(FileAttr { stat: stat }) + Ok(FileAttr { stat }) } pub fn fsync(&self) -> io::Result<()> { @@ -807,7 +807,7 @@ pub fn stat(p: &Path) -> io::Result { cvt(unsafe { stat64(p.as_ptr(), &mut stat) })?; - Ok(FileAttr { stat: stat }) + Ok(FileAttr { stat }) } pub fn lstat(p: &Path) -> io::Result { @@ -816,7 +816,7 @@ pub fn lstat(p: &Path) -> io::Result { cvt(unsafe { lstat64(p.as_ptr(), &mut stat) })?; - Ok(FileAttr { stat: stat }) + Ok(FileAttr { stat }) } pub fn canonicalize(p: &Path) -> io::Result { diff --git a/src/libstd/sys/unix/time.rs b/src/libstd/sys/unix/time.rs index 0b1fb726357..af51f8a8e25 100644 --- a/src/libstd/sys/unix/time.rs +++ b/src/libstd/sys/unix/time.rs @@ -217,7 +217,7 @@ mod inner { impl From for SystemTime { fn from(t: libc::timespec) -> SystemTime { - SystemTime { t: Timespec { t: t } } + SystemTime { t: Timespec { t } } } } @@ -332,7 +332,7 @@ mod inner { impl From for SystemTime { fn from(t: libc::timespec) -> SystemTime { - SystemTime { t: Timespec { t: t } } + SystemTime { t: Timespec { t } } } } diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index 4974a8de89c..ff1ee0d26fe 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -241,7 +241,7 @@ impl<'a> DropGuard<'a> { fn new(lock: &'a Mutex) -> DropGuard<'a> { unsafe { lock.lock(); - DropGuard { lock: lock } + DropGuard { lock } } } } diff --git a/src/libstd/sys/windows/time.rs b/src/libstd/sys/windows/time.rs index 07e64d386a1..54bcbc76b1a 100644 --- a/src/libstd/sys/windows/time.rs +++ b/src/libstd/sys/windows/time.rs @@ -170,7 +170,7 @@ impl fmt::Debug for SystemTime { impl From for SystemTime { fn from(t: c::FILETIME) -> SystemTime { - SystemTime { t: t } + SystemTime { t } } } diff --git a/src/libstd/sys_common/poison.rs b/src/libstd/sys_common/poison.rs index 1625efe4a2a..af93571a604 100644 --- a/src/libstd/sys_common/poison.rs +++ b/src/libstd/sys_common/poison.rs @@ -174,7 +174,7 @@ impl PoisonError { /// [`RwLock::read`]: ../../std/sync/struct.RwLock.html#method.read #[stable(feature = "sync_poison", since = "1.2.0")] pub fn new(guard: T) -> PoisonError { - PoisonError { guard: guard } + PoisonError { guard } } /// Consumes this error indicating that a lock is poisoned, returning the diff --git a/src/libstd/sys_common/wtf8.rs b/src/libstd/sys_common/wtf8.rs index 8725abe7416..19ce932aa12 100644 --- a/src/libstd/sys_common/wtf8.rs +++ b/src/libstd/sys_common/wtf8.rs @@ -67,7 +67,7 @@ impl CodePoint { /// Only use when `value` is known to be less than or equal to 0x10FFFF. #[inline] pub unsafe fn from_u32_unchecked(value: u32) -> CodePoint { - CodePoint { value: value } + CodePoint { value } } /// Creates a new `CodePoint` if the value is a valid code point. @@ -76,7 +76,7 @@ impl CodePoint { #[inline] pub fn from_u32(value: u32) -> Option { match value { - 0 ..= 0x10FFFF => Some(CodePoint { value: value }), + 0 ..= 0x10FFFF => Some(CodePoint { value }), _ => None } } diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index f5d1bd6255e..e1ba8897a47 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -126,7 +126,7 @@ pub fn expand_include<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::T } } - Box::new(ExpandResult { p: p }) + Box::new(ExpandResult { p }) } // include_str! : read the given file, insert it as a literal string expr diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 95a2298ca75..378df6461f1 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -944,7 +944,7 @@ pub fn noop_fold_item_kind(i: ItemKind, folder: &mut T) -> ItemKind { ItemKind::Enum(enum_definition, generics) => { let generics = folder.fold_generics(generics); let variants = enum_definition.variants.move_map(|x| folder.fold_variant(x)); - ItemKind::Enum(ast::EnumDef { variants: variants }, generics) + ItemKind::Enum(ast::EnumDef { variants }, generics) } ItemKind::Struct(struct_def, generics) => { let generics = folder.fold_generics(generics); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index c7089a295fc..d97ad2aa8eb 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -6871,7 +6871,7 @@ impl<'a> Parser<'a> { _ => () } - Ok(ast::EnumDef { variants: variants }) + Ok(ast::EnumDef { variants }) } /// Parse an "enum" declaration