about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-11-07 18:02:05 +0800
committerkennytm <kennytm@gmail.com>2018-11-07 21:27:00 +0800
commit9d9146ad957494821aa3d54aedf4dbcb6c3b7cea (patch)
treeca62a9b11c4a34f8ca15040e97fdd144e58d075b /src/librustc
parente222d1db3c0fc437a7e44af7a44d3e8628cc875a (diff)
parenteca11b99a7d25e4e6573472a16537c1aacb5d5e1 (diff)
downloadrust-9d9146ad957494821aa3d54aedf4dbcb6c3b7cea.tar.gz
rust-9d9146ad957494821aa3d54aedf4dbcb6c3b7cea.zip
Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwco
refactor: use shorthand fields

refactor: use shorthand for single fields everywhere (excluding tests).
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/infer/resolve.rs4
-rw-r--r--src/librustc/infer/type_variable.rs2
-rw-r--r--src/librustc/infer/unify_key.rs2
-rw-r--r--src/librustc/middle/stability.rs2
-rw-r--r--src/librustc/mir/mod.rs2
-rw-r--r--src/librustc/mir/tcx.rs2
-rw-r--r--src/librustc/traits/project.rs2
-rw-r--r--src/librustc/traits/select.rs2
-rw-r--r--src/librustc/ty/_match.rs2
-rw-r--r--src/librustc/ty/fold.rs2
10 files changed, 11 insertions, 11 deletions
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 ec8e7d06058..5d456481896 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 36bc2edcf58..c2014a5fdd2 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -2986,7 +2986,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 473730c5489..4b53235eab4 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 a388c7eeb7e..6b5eb4293e0 100644
--- a/src/librustc/traits/project.rs
+++ b/src/librustc/traits/project.rs
@@ -266,7 +266,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 312cd66dcc7..550c27ca0ab 100644
--- a/src/librustc/traits/select.rs
+++ b/src/librustc/traits/select.rs
@@ -3526,7 +3526,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 8c822adf7b0..ffa4380a5d6 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)