]> git.lizzy.rs Git - rust.git/commitdiff
refactor: use shorthand fields
authorteresy <hi.teresy@gmail.com>
Tue, 6 Nov 2018 20:05:44 +0000 (15:05 -0500)
committerteresy <hi.teresy@gmail.com>
Tue, 6 Nov 2018 20:05:44 +0000 (15:05 -0500)
57 files changed:
src/liballoc/string.rs
src/libpanic_unwind/dwarf/mod.rs
src/libpanic_unwind/seh64_gnu.rs
src/librustc/infer/resolve.rs
src/librustc/infer/type_variable.rs
src/librustc/infer/unify_key.rs
src/librustc/middle/stability.rs
src/librustc/mir/mod.rs
src/librustc/mir/tcx.rs
src/librustc/traits/project.rs
src/librustc/traits/select.rs
src/librustc/ty/_match.rs
src/librustc/ty/fold.rs
src/librustc_codegen_llvm/llvm/mod.rs
src/librustc_codegen_llvm/mir/analyze.rs
src/librustc_codegen_utils/symbol_names_test.rs
src/librustc_data_structures/flock.rs
src/librustc_data_structures/svh.rs
src/librustc_lint/types.rs
src/librustc_metadata/encoder.rs
src/librustc_mir/build/scope.rs
src/librustc_mir/dataflow/impls/borrowed_locals.rs
src/librustc_mir/dataflow/impls/storage_liveness.rs
src/librustc_mir/hair/pattern/check_match.rs
src/librustc_mir/hair/pattern/mod.rs
src/librustc_mir/transform/elaborate_drops.rs
src/librustc_mir/transform/simplify.rs
src/librustc_mir/transform/simplify_branches.rs
src/librustc_passes/ast_validation.rs
src/librustc_resolve/lib.rs
src/librustc_save_analysis/json_dumper.rs
src/librustc_typeck/check/wfcheck.rs
src/librustc_typeck/coherence/orphan.rs
src/librustc_typeck/coherence/unsafety.rs
src/librustc_typeck/collect.rs
src/librustc_typeck/impl_wf_check.rs
src/librustdoc/clean/mod.rs
src/libstd/collections/hash/map.rs
src/libstd/fs.rs
src/libstd/io/util.rs
src/libstd/sync/mpsc/mod.rs
src/libstd/sys/cloudabi/time.rs
src/libstd/sys/redox/fd.rs
src/libstd/sys/redox/fs.rs
src/libstd/sys/redox/syscall/error.rs
src/libstd/sys/redox/thread.rs
src/libstd/sys/redox/time.rs
src/libstd/sys/unix/fd.rs
src/libstd/sys/unix/fs.rs
src/libstd/sys/unix/time.rs
src/libstd/sys/windows/process.rs
src/libstd/sys/windows/time.rs
src/libstd/sys_common/poison.rs
src/libstd/sys_common/wtf8.rs
src/libsyntax/ext/source_util.rs
src/libsyntax/fold.rs
src/libsyntax/parse/parser.rs

index ab3f8fc27072071c754c842094d57b295e441dbc..0dffbd9a4c3522e1bf855bbed6fb058b900b8dfb 100644 (file)
@@ -502,7 +502,7 @@ pub fn from_str(_: &str) -> String {
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn from_utf8(vec: Vec<u8>) -> Result<String, FromUtf8Error> {
         match str::from_utf8(&vec) {
-            Ok(..) => Ok(String { vec: vec }),
+            Ok(..) => Ok(String { vec }),
             Err(e) => {
                 Err(FromUtf8Error {
                     bytes: vec,
index 7e0c32fe03d8a57a43f5d7b17e8264e646fdbc88..3ff250ff6592bdbb717ab98c273b7b20d94e1a48 100644 (file)
@@ -29,7 +29,7 @@ pub struct DwarfReader {
 
 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
index c2074db00385b8367c823eb44d3ba4365d65b1c0..60e9829ef9eaffdef851e06fe30ebace8353b5a5 100644 (file)
@@ -41,7 +41,7 @@ struct PanicData {
 }
 
 pub unsafe fn panic(data: Box<dyn Any + Send>) -> 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,
index 0ef97618572640f4ac5e1003963d1a3e56c7971b..a0c310ac2761e1fbf869fc57bb29764d8a2915ff 100644 (file)
@@ -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 }
     }
 }
 
index 970b6e096ffe4d04370e482d43e079e29daa214e..39bf59a7a4ec5d31e5240fd12a4f9eb0c554f403 100644 (file)
@@ -169,7 +169,7 @@ pub fn instantiate(&mut self, vid: ty::TyVid, ty: Ty<'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.
index cdc92877a5ae82e0596f6b256af74e78136852fb..f8001e085c469e4c3b74f62655f434584177e381 100644 (file)
@@ -43,7 +43,7 @@ fn unify_values(value1: &Self, value2: &Self) -> Result<Self, NoError> {
             value2.min_vid
         };
 
-        Ok(RegionVidKey { min_vid: min_vid })
+        Ok(RegionVidKey { min_vid })
     }
 }
 
index 9dd13dd2272b048a5e24ec4f358e0584b75ffd9c..30e1d49c445fc4092242a0b5e07fb87489d7310f 100644 (file)
@@ -469,7 +469,7 @@ pub fn local_deprecation_entry(&self, id: HirId) -> Option<DeprecationEntry> {
 /// 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());
 }
 
index 9a0623ca539387c930d870092fa32fe40d268e99..a7a3c0afb089459e41b66de0922af87a2c5ffc94 100644 (file)
@@ -2871,7 +2871,7 @@ fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
         use mir::TerminatorKind::*;
 
         let kind = match self.kind {
-            Goto { target } => Goto { target: target },
+            Goto { target } => Goto { target },
             SwitchInt {
                 ref discr,
                 switch_ty,
index fc7b4862b0ae5d0d927962e78c2a332367079e5e..0fa37609f34d9f7c1c18eba996ce58c042e40036 100644 (file)
@@ -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> {
index 7c1f87fbf3fefe1f25e2f488e1952e1e485ae8e1..6d2b545f1b0aa197205b74a280f1e95fe068bc5a 100644 (file)
@@ -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 })
         }
     }
 }
index 156a27a7d0abd9c48c49434c477fa97530ecd0f7..a4a5efad1f5803e97b08d4a4c2e914eedc272a28 100644 (file)
@@ -3434,7 +3434,7 @@ fn confirm_builtin_unsize_candidate(
             _ => bug!(),
         };
 
-        Ok(VtableBuiltinData { nested: nested })
+        Ok(VtableBuiltinData { nested })
     }
 
     ///////////////////////////////////////////////////////////////////////////
index c9b0e97c9b05c61847e79409a6232055c2ba1647..d20b6d361991b6804630e997bc0cb5c2d3efe72c 100644 (file)
@@ -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 }
     }
 }
 
index f54dcfa37e944021697c6275ed7a8373ec64d34d..329abe609b5589c90650842f7f81b87da974a20a 100644 (file)
@@ -82,7 +82,7 @@ fn has_escaping_regions(&self) -> bool {
     }
 
     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)
index 4343c8c184ecf02b8a9b4d87246e77858dc016f5..fbd5192a63f8e42c1ccc93eec222af882e97c96b 100644 (file)
@@ -190,7 +190,7 @@ impl ObjectFile {
     pub fn new(llmb: &'static mut MemoryBuffer) -> Option<ObjectFile> {
         unsafe {
             let llof = LLVMCreateObjectFile(llmb)?;
-            Some(ObjectFile { llof: llof })
+            Some(ObjectFile { llof })
         }
     }
 }
index a0d6cc4629589da5572e08bfac18c963e6e1ab70..aad08550d97fb5743add84d1b9e6e8e5935d5688 100644 (file)
@@ -328,7 +328,7 @@ fn propagate<'tcx>(result: &mut IndexVec<mir::BasicBlock, CleanupKind>,
                        funclet, succ, kind);
                 match kind {
                     CleanupKind::NotCleanup => {
-                        result[succ] = CleanupKind::Internal { funclet: funclet };
+                        result[succ] = CleanupKind::Internal { funclet };
                     }
                     CleanupKind::Funclet => {
                         if funclet != succ {
index 47bbd67fb5c70840cc5fdf85e8cfca77338df991..6eaf0c1c08da126778ef2170931229d764ec5c1c 100644 (file)
@@ -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);
     })
 }
index 38ce331051fecc81b029a2bd460a0406963e8644..86e48e21626abd39b4a9546c237de189595464f9 100644 (file)
@@ -214,7 +214,7 @@ pub fn new(p: &Path,
                     unsafe { libc::close(fd); }
                     Err(err)
                 } else {
-                    Ok(Lock { fd: fd })
+                    Ok(Lock { fd })
                 }
             }
         }
index 94f132562b5ea460cadae948fb116de58e46e0d6..3d17824608cc81b485a35440e272387b0b7884e3 100644 (file)
@@ -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 {
index a441f7a87f763c4bba857b80abbdf93153d51958..af32218fe206868fc6f5a7cebf46c9eef96fa54b 100644 (file)
@@ -794,7 +794,7 @@ fn get_lints(&self) -> LintArray {
 
 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 {
index c36ae02ab54e0a5112d24527c9183fd611057db7..153dbf3b4c595b6c640b39213abb6ec097a5fb36 100644 (file)
@@ -323,7 +323,7 @@ fn encode_info_for_items(&mut self) -> Index {
         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);
index cc5b08f2a90474776ee07ef381c9b0f06d8fdb0e..c62188e7ac942ec03f9e8224656d0afdde52630b 100644 (file)
@@ -453,7 +453,7 @@ pub fn exit_scope(&mut self,
         }
         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
         }
index 8d186597b142c32517a3ccd680549971c9595780..1e279d8dd97083295f2d74e9cf94545bd6aad010 100644 (file)
@@ -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> {
index ab03ace23d7b4ef635a9c39f6e82bee7da5dc15e..c8faa34df8a2bcda20bbf9320f4709834807b373 100644 (file)
@@ -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> {
index f2ae5774da875f8eb014635cbcef5e05ba42f894..9f99f0362e73df2182145fb0fa841e1ff6a96ae0 100644 (file)
@@ -52,7 +52,7 @@ fn visit_body(&mut self, body: &'tcx hir::Body) {
 }
 
 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();
 }
 
index cb974366a3029b7560f86c72f0379f735e00db0c..d70b274322bb53b49d93b3b4424f185312052d74 100644 (file)
@@ -459,7 +459,7 @@ fn lower_pattern_unadjusted(&mut self, pat: &'tcx hir::Pat) -> Pattern<'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 @@ fn lower_variant_or_leaf(
                         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 }
             }
 
             _ => {
index 9d77289d7b9b172d64377269d4278498b58bc694..f3d0d0520c70036b110e34806fd70347a97ddb13 100644 (file)
@@ -495,7 +495,7 @@ fn elaborate_replace(
         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,
index a6e0932bf0acec6860272ad15ba50c5c7ab71e8c..a624b05bbbe4bf75f0e3459c7bb91d4f18889c6f 100644 (file)
@@ -302,7 +302,7 @@ fn run_pass<'a, 'tcx>(&self,
 
         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();
     }
 }
index e14941b8aeb9a2e6075214eb907edff21cb6032d..b24898095435b4dc227b3cadd09428c6f8c2c2a2 100644 (file)
@@ -57,7 +57,7 @@ fn run_pass<'a, 'tcx>(&self,
                 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 }
index f6ace57f5e0fb52b36a93ac795cdc23426f2a53a..89d5465e601c18820f02406e0048dfd316e30c32 100644 (file)
@@ -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)
 }
index 86fe584dc3a40fe937c4199474e1958402d8602c..94568989ef3a5a791ad4f3519c6fbdec25aafd69 100644 (file)
@@ -4424,7 +4424,7 @@ fn lookup_import_candidates_from_module<FilterFn>(&mut self,
                         // 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 @@ fn find_module(&mut self,
                             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()) {
index e14ac73ee10202b1eb450fdf5de59d5511f810c9..53ec67070951e7a33f494a5aec315f33e4c1b4b0 100644 (file)
@@ -71,7 +71,7 @@ pub fn with_callback(
         config: Config,
     ) -> JsonDumper<CallbackOutput<'b>> {
         JsonDumper {
-            output: CallbackOutput { callback: callback },
+            output: CallbackOutput { callback },
             config: config.clone(),
             result: Analysis::new(config),
         }
index cc1906d91d4c9bc438847f0c029e5f9e014e420d..d40b2f1833a4e46d34697763eeef5437350701e4 100644 (file)
@@ -962,7 +962,7 @@ fn non_enum_variant(&self, struct_def: &hir::VariantData) -> AdtVariant<'tcx> {
             AdtField { ty: field_ty, span: field.span }
         })
         .collect();
-        AdtVariant { fields: fields }
+        AdtVariant { fields }
     }
 
     fn enum_variants(&self, enum_def: &hir::EnumDef) -> Vec<AdtVariant<'tcx>> {
index b155587dddc419f284fcda6978e89a0201c98f98..14c6864434fcfcbf5cd15c7c59d6c3da64226544 100644 (file)
@@ -17,7 +17,7 @@
 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);
 }
 
index bdbf93ddec286c2506b7d2ce91b703f4fd8a31a5..0894c1d49e80e7e7e0ae97770063d8af35ba2d90 100644 (file)
@@ -16,7 +16,7 @@
 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);
 }
 
index f96c85ae7ae3fc497036a0e1a19cb0ecfa097384..3cefe302ac4219242974b51350a19592d39f0848 100644 (file)
@@ -62,7 +62,7 @@
 // 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());
index 7e0a8d63e2889a13b70084ca38455829beed28f0..b79d1279e3d2874347a3b21480f64c8ec97b036a 100644 (file)
@@ -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> {
index 2ba1f103971f074548fae0f23f5c994178435f8f..88e4ebeb39efc2a22281d9a0397212468e8d7946 100644 (file)
@@ -2959,7 +2959,7 @@ fn clean(&self, cx: &DocContext) -> Item {
             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),
         }
index ef5dae724b247eef53a77abd52376d286f76c621..04e1632460b183425d94b471b1dcbd0963e471d4 100644 (file)
@@ -2854,7 +2854,7 @@ fn new(k: usize) -> Droppable {
                 slot.borrow_mut()[k] += 1;
             });
 
-            Droppable { k: k }
+            Droppable { k }
         }
     }
 
index 017949291bcf16e37f200141b9254d9fdbaad544..c2ced266294c42bb379b5a6b81da7a20dd575504 100644 (file)
@@ -877,7 +877,7 @@ pub fn open<P: AsRef<Path>>(&self, path: P) -> io::Result<File> {
 
     fn _open(&self, path: &Path) -> io::Result<File> {
         let inner = fs_imp::File::open(path, &self.0)?;
-        Ok(File { inner: inner })
+        Ok(File { inner })
     }
 }
 
index 371e5b21c13b26c117b915b4ec04d22d8ad764b1..12995d08683450175af2c3fe2b5b1377c70ab320 100644 (file)
@@ -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 {
index 59cf741487e443710cdd1e32222abe4cf8a7c92b..81f98a55c117149bd5bfe8aa0e9f3d907853eb81 100644 (file)
@@ -931,7 +931,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
 impl<T> SyncSender<T> {
     fn new(inner: Arc<sync::Packet<T>>) -> SyncSender<T> {
-        SyncSender { inner: inner }
+        SyncSender { inner }
     }
 
     /// Sends a value on this synchronous channel.
index ee12731619aac3bfbae63a38a796ba8984a7ec4d..3d66998b9f549e91108e3dfdd8b7e7b77fcfd5b5 100644 (file)
@@ -32,7 +32,7 @@ pub fn now() -> 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 @@ pub fn now() -> 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 }
         }
     }
 
index e04e2791b23a1a496694af26b6f134d7a566ba27..d61103a872f9e6781d2f890cba298ae09ae56622 100644 (file)
@@ -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 }
index 2e2216186f1e6b8228e4a425a0c3345f494b534f..6059406997dff100f458c1e4c64f180d81f2754c 100644 (file)
@@ -264,7 +264,7 @@ pub fn open(path: &Path, opts: &OpenOptions) -> io::Result<File> {
     pub fn file_attr(&self) -> io::Result<FileAttr> {
         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<()> {
index 1ef79547431f8ac0a23d9e3a85d92c288da346fa..1e3783705537ab274b651a115a723dea7a53f5b3 100644 (file)
@@ -19,7 +19,7 @@ pub struct Error {
 
 impl Error {
     pub fn new(errno: i32) -> Error {
-        Error { errno: errno }
+        Error { errno }
     }
 
     pub fn mux(result: Result<usize>) -> usize {
index f4177087d77a1e24cd68dc06f0f5e52fa6332583..bab91b16e6c0a4f3bdec59a71c14a8570c7a87d8 100644 (file)
@@ -38,7 +38,7 @@ pub unsafe fn new<'a>(_stack: usize, p: Box<dyn FnBox() + 'a>) -> io::Result<Thr
             panic!("thread failed to exit");
         } else {
             mem::forget(p);
-            Ok(Thread { id: id })
+            Ok(Thread { id })
         }
     }
 
index 5c491115c55160dafcc356c2082699454b9b29f4..aac6d2704e790cd0519d77e44a27a5c46e4c8ea4 100644 (file)
@@ -187,7 +187,7 @@ pub fn sub_duration(&self, other: &Duration) -> SystemTime {
 
 impl From<syscall::TimeSpec> for SystemTime {
     fn from(t: syscall::TimeSpec) -> SystemTime {
-        SystemTime { t: Timespec { t: t } }
+        SystemTime { t: Timespec { t } }
     }
 }
 
index db2ea6b660a7ab73a4f882ccbf8d8d1f789a2b25..af33d2636fb1fef1bd8ce5facaade975585e514c 100644 (file)
@@ -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 }
index 1d5b0cfa94ad549e9252ed00b7fe2a5d9e812b57..add06aec11b64a294d558f57b9f84383bea0f454 100644 (file)
@@ -317,7 +317,7 @@ pub fn metadata(&self) -> io::Result<FileAttr> {
         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 @@ pub fn file_attr(&self) -> io::Result<FileAttr> {
         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<FileAttr> {
     cvt(unsafe {
         stat64(p.as_ptr(), &mut stat)
     })?;
-    Ok(FileAttr { stat: stat })
+    Ok(FileAttr { stat })
 }
 
 pub fn lstat(p: &Path) -> io::Result<FileAttr> {
@@ -816,7 +816,7 @@ pub fn lstat(p: &Path) -> io::Result<FileAttr> {
     cvt(unsafe {
         lstat64(p.as_ptr(), &mut stat)
     })?;
-    Ok(FileAttr { stat: stat })
+    Ok(FileAttr { stat })
 }
 
 pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
index 0b1fb726357e1056d8685ce50e338843d842c5a8..af51f8a8e257a0875f8154ebb298040b6fdf7b88 100644 (file)
@@ -217,7 +217,7 @@ fn from(t: libc::timeval) -> SystemTime {
 
     impl From<libc::timespec> for SystemTime {
         fn from(t: libc::timespec) -> SystemTime {
-            SystemTime { t: Timespec { t: t } }
+            SystemTime { t: Timespec { t } }
         }
     }
 
@@ -332,7 +332,7 @@ pub fn sub_duration(&self, other: &Duration) -> SystemTime {
 
     impl From<libc::timespec> for SystemTime {
         fn from(t: libc::timespec) -> SystemTime {
-            SystemTime { t: Timespec { t: t } }
+            SystemTime { t: Timespec { t } }
         }
     }
 
index 4974a8de89c79f91d6850d0b017221720046ecbc..ff1ee0d26fe5412a944a55a733426e857fed7c73 100644 (file)
@@ -241,7 +241,7 @@ impl<'a> DropGuard<'a> {
     fn new(lock: &'a Mutex) -> DropGuard<'a> {
         unsafe {
             lock.lock();
-            DropGuard { lock: lock }
+            DropGuard { lock }
         }
     }
 }
index 07e64d386a1c2b7c94927fda6d73a1f6b190ba5e..54bcbc76b1a3c347ba64b23fa03087f61e3ae92d 100644 (file)
@@ -170,7 +170,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
 impl From<c::FILETIME> for SystemTime {
     fn from(t: c::FILETIME) -> SystemTime {
-        SystemTime { t: t }
+        SystemTime { t }
     }
 }
 
index 1625efe4a2ae7142a06023a31b1058991a2bcdd8..af93571a604828508c7245610601f95b5544f946 100644 (file)
@@ -174,7 +174,7 @@ impl<T> PoisonError<T> {
     /// [`RwLock::read`]: ../../std/sync/struct.RwLock.html#method.read
     #[stable(feature = "sync_poison", since = "1.2.0")]
     pub fn new(guard: T) -> PoisonError<T> {
-        PoisonError { guard: guard }
+        PoisonError { guard }
     }
 
     /// Consumes this error indicating that a lock is poisoned, returning the
index 8725abe741679a50da912a28021ba9be6800986d..19ce932aa1233f6985158b03ef75fa05d5d641eb 100644 (file)
@@ -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 @@ pub unsafe fn from_u32_unchecked(value: u32) -> CodePoint {
     #[inline]
     pub fn from_u32(value: u32) -> Option<CodePoint> {
         match value {
-            0 ..= 0x10FFFF => Some(CodePoint { value: value }),
+            0 ..= 0x10FFFF => Some(CodePoint { value }),
             _ => None
         }
     }
index f5d1bd6255e2abe6d1800f59cd35254398c65a7b..e1ba8897a47f4d76d6df8cc457167bcddc5d9d3a 100644 (file)
@@ -126,7 +126,7 @@ fn make_expr(mut self: Box<ExpandResult<'a>>) -> Option<P<ast::Expr>> {
         }
     }
 
-    Box::new(ExpandResult { p: p })
+    Box::new(ExpandResult { p })
 }
 
 // include_str! : read the given file, insert it as a literal string expr
index 95a2298ca757db404c30d156b2e09e0e37db0cdd..378df6461f1303f7077a1132d546069bc4c645d6 100644 (file)
@@ -944,7 +944,7 @@ pub fn noop_fold_item_kind<T: Folder>(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);
index c7089a295fc3dca4787d0b8b40e0f4ca0fde56ff..d97ad2aa8eb8bc1da7381dadc3772d7820b2ae0a 100644 (file)
@@ -6871,7 +6871,7 @@ fn parse_enum_def(&mut self, _generics: &ast::Generics) -> PResult<'a, EnumDef>
             _ => ()
         }
 
-        Ok(ast::EnumDef { variants: variants })
+        Ok(ast::EnumDef { variants })
     }
 
     /// Parse an "enum" declaration