use field init shorthand in src/librustc
The field init shorthand syntax was stabilized in 1.17.0 (aebd94f); we
are now free to use it in the compiler.
diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs
index 85b1858..fa6b780 100644
--- a/src/librustc/cfg/construct.rs
+++ b/src/librustc/cfg/construct.rs
@@ -58,11 +58,11 @@
let tables = tcx.typeck_tables_of(owner_def_id);
let mut cfg_builder = CFGBuilder {
- tcx: tcx,
+ tcx,
owner_def_id,
- tables: tables,
- graph: graph,
- fn_exit: fn_exit,
+ tables,
+ graph,
+ fn_exit,
loop_scopes: Vec::new(),
breakable_block_scopes: Vec::new(),
};
@@ -70,8 +70,8 @@
cfg_builder.add_contained_edge(body_exit, fn_exit);
let CFGBuilder { graph, .. } = cfg_builder;
CFG {
- graph: graph,
- entry: entry,
+ graph,
+ entry,
exit: fn_exit,
}
}
diff --git a/src/librustc/dep_graph/dep_tracking_map.rs b/src/librustc/dep_graph/dep_tracking_map.rs
index 43f8d6b..ca53fd7 100644
--- a/src/librustc/dep_graph/dep_tracking_map.rs
+++ b/src/librustc/dep_graph/dep_tracking_map.rs
@@ -36,7 +36,7 @@
pub fn new(graph: DepGraph) -> DepTrackingMap<M> {
DepTrackingMap {
phantom: PhantomData,
- graph: graph,
+ graph,
map: FxHashMap(),
}
}
diff --git a/src/librustc/dep_graph/query.rs b/src/librustc/dep_graph/query.rs
index 116c527..283da10 100644
--- a/src/librustc/dep_graph/query.rs
+++ b/src/librustc/dep_graph/query.rs
@@ -36,8 +36,8 @@
}
DepGraphQuery {
- graph: graph,
- indices: indices
+ graph,
+ indices,
}
}
diff --git a/src/librustc/dep_graph/shadow.rs b/src/librustc/dep_graph/shadow.rs
index 8808ea5..e32acbf 100644
--- a/src/librustc/dep_graph/shadow.rs
+++ b/src/librustc/dep_graph/shadow.rs
@@ -59,7 +59,7 @@
ShadowGraph {
stack: RefCell::new(vec![]),
- forbidden_edge: forbidden_edge,
+ forbidden_edge,
}
}
diff --git a/src/librustc/dep_graph/thread.rs b/src/librustc/dep_graph/thread.rs
index ad0abfe..f6635fe 100644
--- a/src/librustc/dep_graph/thread.rs
+++ b/src/librustc/dep_graph/thread.rs
@@ -78,7 +78,7 @@
}
DepGraphThreadData {
- enabled: enabled,
+ enabled,
shadow_graph: ShadowGraph::new(),
messages: VecCell::with_capacity(INITIAL_CAPACITY),
swap_in: rx2,
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 873d39e..a6a2943 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -126,9 +126,9 @@
LoweringContext {
crate_root: std_inject::injected_crate_name(krate),
- sess: sess,
+ sess,
parent_def: None,
- resolver: resolver,
+ resolver,
name_map: FxHashMap(),
items: BTreeMap::new(),
trait_items: BTreeMap::new(),
@@ -251,15 +251,15 @@
.init_node_id_to_hir_id_mapping(self.node_id_to_hir_id);
hir::Crate {
- module: module,
- attrs: attrs,
+ module,
+ attrs,
span: c.span,
exported_macros: hir::HirVec::from(self.exported_macros),
items: self.items,
trait_items: self.trait_items,
impl_items: self.impl_items,
bodies: self.bodies,
- body_ids: body_ids,
+ body_ids,
trait_impls: self.trait_impls,
trait_default_impl: self.trait_default_impl,
}
@@ -368,7 +368,7 @@
arguments: decl.map_or(hir_vec![], |decl| {
decl.inputs.iter().map(|x| self.lower_arg(x)).collect()
}),
- value: value
+ value,
};
let id = body.id();
self.bodies.insert(id, body);
@@ -809,7 +809,7 @@
self.lower_path_segment(p.span, segment, param_mode, 0)
}).chain(name.map(|name| {
hir::PathSegment {
- name: name,
+ name,
parameters: hir::PathParameters::none()
}
})).collect(),
@@ -857,7 +857,7 @@
hir::PathSegment {
name: self.lower_ident(segment.identifier),
- parameters: parameters,
+ parameters,
}
}
@@ -881,7 +881,7 @@
hir::ParenthesizedParameterData {
inputs: inputs.iter().map(|ty| self.lower_ty(ty)).collect(),
output: output.as_ref().map(|ty| self.lower_ty(ty)),
- span: span,
+ span,
}
}
@@ -970,8 +970,8 @@
hir::TyParam {
id: self.lower_node_id(tp.id),
- name: name,
- bounds: bounds,
+ name,
+ bounds,
default: tp.default.as_ref().map(|x| self.lower_ty(x)),
span: tp.span,
pure_wrt_drop: tp.attrs.iter().any(|attr| attr.check_name("may_dangle")),
@@ -1081,14 +1081,14 @@
TraitTyParamBound(_, TraitBoundModifier::Maybe) => None,
_ => Some(self.lower_ty_param_bound(bound))
}).collect(),
- span: span,
+ span,
})
}
WherePredicate::RegionPredicate(WhereRegionPredicate{ ref lifetime,
ref bounds,
span}) => {
hir::WherePredicate::RegionPredicate(hir::WhereRegionPredicate {
- span: span,
+ span,
lifetime: self.lower_lifetime(lifetime),
bounds: bounds.iter().map(|bound| self.lower_lifetime(bound)).collect(),
})
@@ -1101,7 +1101,7 @@
id: self.lower_node_id(id),
lhs_ty: self.lower_ty(lhs_ty),
rhs_ty: self.lower_ty(rhs_ty),
- span: span,
+ span,
})
}
}
@@ -1133,7 +1133,7 @@
qpath => bug!("lower_trait_ref: unexpected QPath `{:?}`", qpath)
};
hir::TraitRef {
- path: path,
+ path,
ref_id: self.lower_node_id(p.ref_id),
}
}
@@ -1201,10 +1201,10 @@
P(hir::Block {
id: self.lower_node_id(b.id),
stmts: stmts.into(),
- expr: expr,
+ expr,
rules: self.lower_block_check_mode(&b.rules),
span: b.span,
- targeted_by_break: targeted_by_break,
+ targeted_by_break,
})
}
@@ -1259,8 +1259,8 @@
name: import.rename.unwrap_or(ident).name,
attrs: attrs.clone(),
node: hir::ItemUse(P(path), hir::UseKind::Single),
- vis: vis,
- span: span,
+ vis,
+ span,
});
});
}
@@ -1441,7 +1441,7 @@
name: self.lower_ident(i.ident),
span: i.span,
defaultness: self.lower_defaultness(Defaultness::Default, has_default),
- kind: kind,
+ kind,
}
}
@@ -1523,9 +1523,9 @@
if let ItemKind::MacroDef(ref def) = i.node {
if !def.legacy || i.attrs.iter().any(|attr| attr.path == "macro_export") {
self.exported_macros.push(hir::MacroDef {
- name: name,
- vis: vis,
- attrs: attrs,
+ name,
+ vis,
+ attrs,
id: i.id,
span: i.span,
body: def.stream(),
@@ -1541,10 +1541,10 @@
Some(hir::Item {
id: self.lower_node_id(i.id),
- name: name,
- attrs: attrs,
- node: node,
- vis: vis,
+ name,
+ attrs,
+ node,
+ vis,
span: i.span,
})
}
@@ -1650,7 +1650,7 @@
Some(def) => {
hir::PatKind::Path(hir::QPath::Resolved(None, P(hir::Path {
span: pth1.span,
- def: def,
+ def,
segments: hir_vec![
hir::PathSegment::from_name(pth1.node.name)
],
@@ -1887,9 +1887,9 @@
let blk = P(hir::Block {
stmts: hir_vec![],
expr: Some(els),
- id: id,
+ id,
rules: hir::DefaultBlock,
- span: span,
+ span,
targeted_by_break: false,
});
P(self.expr_block(blk, ThinVec::new()))
@@ -2108,7 +2108,7 @@
sub_expr,
arms.into(),
hir::MatchSource::IfLetDesugar {
- contains_else_clause: contains_else_clause,
+ contains_else_clause,
})
}
@@ -2536,7 +2536,7 @@
fn arm(&mut self, pats: hir::HirVec<P<hir::Pat>>, expr: P<hir::Expr>) -> hir::Arm {
hir::Arm {
attrs: hir_vec![],
- pats: pats,
+ pats,
guard: None,
body: expr,
}
@@ -2546,10 +2546,10 @@
hir::Field {
name: Spanned {
node: name,
- span: span,
+ span,
},
- span: span,
- expr: expr,
+ span,
+ expr,
is_shorthand: false,
}
}
@@ -2578,8 +2578,8 @@
};
let expr_path = hir::ExprPath(hir::QPath::Resolved(None, P(hir::Path {
- span: span,
- def: def,
+ span,
+ def,
segments: hir_vec![hir::PathSegment::from_name(id)],
})));
@@ -2619,9 +2619,9 @@
fn expr(&mut self, span: Span, node: hir::Expr_, attrs: ThinVec<Attribute>) -> hir::Expr {
hir::Expr {
id: self.next_id(),
- node: node,
- span: span,
- attrs: attrs,
+ node,
+ span,
+ attrs,
}
}
@@ -2632,7 +2632,7 @@
source: hir::LocalSource)
-> hir::Stmt {
let local = P(hir::Local {
- pat: pat,
+ pat,
ty: None,
init: ex,
id: self.next_id(),
@@ -2662,11 +2662,11 @@
fn block_all(&mut self, span: Span, stmts: hir::HirVec<hir::Stmt>, expr: Option<P<hir::Expr>>)
-> hir::Block {
hir::Block {
- stmts: stmts,
- expr: expr,
+ stmts,
+ expr,
id: self.next_id(),
rules: hir::DefaultBlock,
- span: span,
+ span,
targeted_by_break: false,
}
}
@@ -2719,15 +2719,15 @@
};
P(hir::Pat {
- id: id,
+ id,
node: hir::PatKind::Binding(bm,
def_id,
Spanned {
- span: span,
+ span,
node: name,
},
None),
- span: span,
+ span,
})
}
@@ -2739,7 +2739,7 @@
P(hir::Pat {
id: self.next_id(),
node: pat,
- span: span,
+ span,
})
}
@@ -2748,7 +2748,7 @@
/// The path is also resolved according to `is_value`.
fn std_path(&mut self, span: Span, components: &[&str], is_value: bool) -> hir::Path {
let mut path = hir::Path {
- span: span,
+ span,
def: Def::Err,
segments: iter::once(keywords::CrateRoot.name()).chain({
self.crate_root.into_iter().chain(components.iter().cloned()).map(Symbol::intern)
@@ -2769,9 +2769,9 @@
let id = self.next_id();
let block = P(hir::Block {
rules: rule,
- span: span,
- id: id,
- stmts: stmts,
+ span,
+ id,
+ stmts,
expr: Some(expr),
targeted_by_break: false,
});
@@ -2810,7 +2810,7 @@
fn elided_lifetime(&mut self, span: Span) -> hir::Lifetime {
hir::Lifetime {
id: self.next_id(),
- span: span,
+ span,
name: keywords::Invalid.name()
}
}
diff --git a/src/librustc/hir/map/blocks.rs b/src/librustc/hir/map/blocks.rs
index ff2f1dc..661798a 100644
--- a/src/librustc/hir/map/blocks.rs
+++ b/src/librustc/hir/map/blocks.rs
@@ -130,9 +130,9 @@
ClosureParts {
decl: d,
body: b,
- id: id,
+ id,
span: s,
- attrs: attrs,
+ attrs,
}
}
}
@@ -149,7 +149,7 @@
};
if fn_like {
Some(FnLikeNode {
- node: node
+ node,
})
} else {
None
@@ -224,12 +224,12 @@
id: i.id,
name: i.name,
decl: &decl,
- unsafety: unsafety,
+ unsafety,
body: block,
- generics: generics,
- abi: abi,
+ generics,
+ abi,
vis: &i.vis,
- constness: constness,
+ constness,
span: i.span,
attrs: &i.attrs,
}),
diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs
index 904f74b..d3ae3e0 100644
--- a/src/librustc/hir/map/collector.rs
+++ b/src/librustc/hir/map/collector.rs
@@ -28,7 +28,7 @@
impl<'hir> NodeCollector<'hir> {
pub fn root(krate: &'hir Crate) -> NodeCollector<'hir> {
let mut collector = NodeCollector {
- krate: krate,
+ krate,
map: vec![],
parent_node: CRATE_NODE_ID,
};
diff --git a/src/librustc/hir/map/def_collector.rs b/src/librustc/hir/map/def_collector.rs
index 7fbefa5..d348a5d 100644
--- a/src/librustc/hir/map/def_collector.rs
+++ b/src/librustc/hir/map/def_collector.rs
@@ -36,8 +36,8 @@
impl<'a> DefCollector<'a> {
pub fn new(definitions: &'a mut Definitions, expansion: Mark) -> Self {
DefCollector {
- definitions: definitions,
- expansion: expansion,
+ definitions,
+ expansion,
parent_def: None,
visit_macro_invoc: None,
}
@@ -86,7 +86,7 @@
if let Some(ref mut visit) = self.visit_macro_invoc {
visit(MacroInvocationData {
mark: id.placeholder_to_mark(),
- const_expr: const_expr,
+ const_expr,
def_index: self.parent_def.unwrap(),
})
}
diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs
index c969aef..d89e86e 100644
--- a/src/librustc/hir/map/definitions.rs
+++ b/src/librustc/hir/map/definitions.rs
@@ -190,9 +190,9 @@
}
Ok(DefPathTable {
- index_to_key: index_to_key,
- key_to_index: key_to_index,
- def_path_hashes: def_path_hashes,
+ index_to_key,
+ key_to_index,
+ def_path_hashes,
})
}
}
@@ -578,7 +578,7 @@
let mut key = DefKey {
parent: Some(parent),
disambiguated_data: DisambiguatedDefPathData {
- data: data,
+ data,
disambiguator: 0
}
};
diff --git a/src/librustc/hir/map/hir_id_validator.rs b/src/librustc/hir/map/hir_id_validator.rs
index b3cc0c5..e6af075 100644
--- a/src/librustc/hir/map/hir_id_validator.rs
+++ b/src/librustc/hir/map/hir_id_validator.rs
@@ -16,7 +16,7 @@
pub fn check_crate<'hir>(hir_map: &hir::map::Map<'hir>) {
let mut outer_visitor = OuterVisitor {
- hir_map: hir_map,
+ hir_map,
errors: vec![],
};
@@ -49,7 +49,7 @@
hir_map: &'a hir::map::Map<'hir>)
-> HirIdValidator<'a, 'hir> {
HirIdValidator {
- hir_map: hir_map,
+ hir_map,
owner_def_index: None,
hir_ids_seen: FxHashMap(),
errors: Vec::new(),
diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs
index 02a36a3..2044d32 100644
--- a/src/librustc/hir/map/mod.rs
+++ b/src/librustc/hir/map/mod.rs
@@ -228,7 +228,7 @@
impl Forest {
pub fn new(krate: Crate, dep_graph: &DepGraph) -> Forest {
Forest {
- krate: krate,
+ krate,
dep_graph: dep_graph.clone(),
inlined_bodies: TypedArena::new()
}
@@ -1057,10 +1057,10 @@
}
let map = Map {
- forest: forest,
+ forest,
dep_graph: forest.dep_graph.clone(),
- map: map,
- definitions: definitions,
+ map,
+ definitions,
inlined_bodies: RefCell::new(DefIdMap()),
};
diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs
index 3f2977c..3443c6b 100644
--- a/src/librustc/hir/mod.rs
+++ b/src/librustc/hir/mod.rs
@@ -218,7 +218,7 @@
/// Convert an identifier to the corresponding segment.
pub fn from_name(name: Name) -> PathSegment {
PathSegment {
- name: name,
+ name,
parameters: PathParameters::none()
}
}
diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs
index c6f4cd5..f32fab7 100644
--- a/src/librustc/hir/print.rs
+++ b/src/librustc/hir/print.rs
@@ -176,7 +176,7 @@
cur_lit: 0,
},
boxes: Vec::new(),
- ann: ann,
+ ann,
}
}
}
@@ -196,7 +196,7 @@
cur_lit: 0,
},
boxes: Vec::new(),
- ann: ann,
+ ann,
};
f(&mut printer).unwrap();
eof(&mut printer.s).unwrap();
diff --git a/src/librustc/ich/caching_codemap_view.rs b/src/librustc/ich/caching_codemap_view.rs
index bf47b9b..49e18f1 100644
--- a/src/librustc/ich/caching_codemap_view.rs
+++ b/src/librustc/ich/caching_codemap_view.rs
@@ -44,7 +44,7 @@
};
CachingCodemapView {
- codemap: codemap,
+ codemap,
line_cache: [entry.clone(), entry.clone(), entry.clone()],
time_stamp: 0,
}
diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs
index 2784a7b..8ce1b39 100644
--- a/src/librustc/ich/hcx.rs
+++ b/src/librustc/ich/hcx.rs
@@ -65,13 +65,13 @@
ignored_attr_names.sort();
StableHashingContext {
- tcx: tcx,
+ tcx,
codemap: CachingCodemapView::new(tcx),
hash_spans: hash_spans_initial,
hash_bodies: true,
overflow_checks_enabled: check_overflow_initial,
node_id_hashing_mode: NodeIdHashingMode::HashDefPath,
- ignored_attr_names: ignored_attr_names,
+ ignored_attr_names,
}
}
diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs
index 14920b8..40e933b 100644
--- a/src/librustc/infer/combine.rs
+++ b/src/librustc/infer/combine.rs
@@ -268,7 +268,7 @@
infcx: self.infcx,
span: self.trace.cause.span,
for_vid_sub_root: self.infcx.type_variables.borrow_mut().sub_root_var(for_vid),
- ambient_variance: ambient_variance,
+ ambient_variance,
needs_wf: false,
};
diff --git a/src/librustc/infer/freshen.rs b/src/librustc/infer/freshen.rs
index a0ef1f6..4185808 100644
--- a/src/librustc/infer/freshen.rs
+++ b/src/librustc/infer/freshen.rs
@@ -48,7 +48,7 @@
pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>)
-> TypeFreshener<'a, 'gcx, 'tcx> {
TypeFreshener {
- infcx: infcx,
+ infcx,
freshen_count: 0,
freshen_map: FxHashMap(),
}
diff --git a/src/librustc/infer/fudge.rs b/src/librustc/infer/fudge.rs
index a8bc33f..9cad6ce 100644
--- a/src/librustc/infer/fudge.rs
+++ b/src/librustc/infer/fudge.rs
@@ -102,7 +102,7 @@
infcx: self,
type_variables: &type_variables,
region_vars: ®ion_vars,
- origin: origin
+ origin,
};
Ok(value.fold_with(&mut fudger))
diff --git a/src/librustc/infer/higher_ranked/mod.rs b/src/librustc/infer/higher_ranked/mod.rs
index dbbcc6c..541a997 100644
--- a/src/librustc/infer/higher_ranked/mod.rs
+++ b/src/librustc/infer/higher_ranked/mod.rs
@@ -218,7 +218,7 @@
Ok(HrMatchResult {
value: a_value,
- unconstrained_regions: unconstrained_regions,
+ unconstrained_regions,
})
});
}
diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs
index 5cb1606..a70a424 100644
--- a/src/librustc/infer/mod.rs
+++ b/src/librustc/infer/mod.rs
@@ -458,9 +458,9 @@
LvalueTy::Ty { ty } => LvalueTy::Ty { ty: ty.trans_normalize(infcx, param_env) },
LvalueTy::Downcast { adt_def, substs, variant_index } => {
LvalueTy::Downcast {
- adt_def: adt_def,
+ adt_def,
substs: substs.trans_normalize(infcx, param_env),
- variant_index: variant_index
+ variant_index,
}
}
}
@@ -674,7 +674,7 @@
-> CombineFields<'a, 'gcx, 'tcx> {
CombineFields {
infcx: self,
- trace: trace,
+ trace,
cause: None,
param_env,
obligations: PredicateObligations::new(),
@@ -1235,7 +1235,7 @@
self.report_and_explain_type_error(
trace,
&TypeError::TyParamDefaultMismatch(ExpectedFound {
- expected: expected,
+ expected,
found: actual
}))
.emit();
@@ -1279,7 +1279,7 @@
let span = cause.span;
let match_trait_ref = match_a.skip_binder().projection_ty.trait_ref;
let trace = TypeTrace {
- cause: cause,
+ cause,
values: TraitRefs(ExpectedFound::new(true, match_trait_ref, match_b))
};
@@ -1443,10 +1443,10 @@
lint_id } =>
SubregionOrigin::CompareImplMethodObligation {
span: cause.span,
- item_name: item_name,
- impl_item_def_id: impl_item_def_id,
- trait_item_def_id: trait_item_def_id,
- lint_id: lint_id,
+ item_name,
+ impl_item_def_id,
+ trait_item_def_id,
+ lint_id,
},
_ => default(),
diff --git a/src/librustc/infer/region_inference/mod.rs b/src/librustc/infer/region_inference/mod.rs
index 6f88b97..4f81689 100644
--- a/src/librustc/infer/region_inference/mod.rs
+++ b/src/librustc/infer/region_inference/mod.rs
@@ -354,7 +354,7 @@
impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> RegionVarBindings<'a, 'gcx, 'tcx> {
RegionVarBindings {
- tcx: tcx,
+ tcx,
var_origins: RefCell::new(Vec::new()),
values: RefCell::new(None),
constraints: RefCell::new(FxHashMap()),
@@ -378,7 +378,7 @@
debug!("RegionVarBindings: start_snapshot({})", length);
self.undo_log.borrow_mut().push(OpenSnapshot);
RegionSnapshot {
- length: length,
+ length,
region_snapshot: self.unification_table.borrow_mut().snapshot(),
skolemization_count: self.skolemization_count.get(),
}
@@ -733,10 +733,10 @@
sub: Region<'tcx>,
bound: VerifyBound<'tcx>) {
self.add_verify(Verify {
- kind: kind,
- origin: origin,
+ kind,
+ origin,
region: sub,
- bound: bound
+ bound,
});
}
@@ -1459,7 +1459,7 @@
ConstrainRegSubVar(region, _) |
ConstrainVarSubReg(_, region) => {
state.result.push(RegionAndOrigin {
- region: region,
+ region,
origin: this.constraints.borrow().get(&edge.data).unwrap().clone(),
});
}
diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs
index 4ae2a80..cc91a63 100644
--- a/src/librustc/infer/type_variable.rs
+++ b/src/librustc/infer/type_variable.rs
@@ -181,8 +181,8 @@
self.sub_relations.new_key(());
let index = self.values.push(TypeVariableData {
value: Bounded { default: default },
- origin: origin,
- diverging: diverging
+ origin,
+ diverging,
});
let v = ty::TyVid { index: index as u32 };
debug!("new_var: diverging={:?} index={:?}", diverging, v);
@@ -369,7 +369,7 @@
fn reverse(values: &mut Vec<TypeVariableData<'tcx>>, action: Instantiate<'tcx>) {
let Instantiate { vid, default } = action;
values[vid.index as usize].value = Bounded {
- default: default
+ default,
};
}
}
diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs
index 8202c61..d67bca1 100644
--- a/src/librustc/lint/context.rs
+++ b/src/librustc/lint/context.rs
@@ -140,8 +140,8 @@
let mut diagnostic = Diagnostic::new(errors::Level::Warning, msg);
diagnostic.set_span(span);
EarlyLint {
- id: id,
- diagnostic: diagnostic,
+ id,
+ diagnostic,
}
}
}
@@ -149,7 +149,7 @@
impl IntoEarlyLint for Diagnostic {
fn into_early_lint(self, id: LintId) -> EarlyLint {
EarlyLint {
- id: id,
+ id,
diagnostic: self,
}
}
@@ -805,8 +805,8 @@
fn new(sess: &'a Session,
krate: &'a ast::Crate) -> EarlyContext<'a> {
EarlyContext {
- sess: sess,
- krate: krate,
+ sess,
+ krate,
lint_sess: LintSession::new(&sess.lint_store),
}
}
@@ -1350,10 +1350,10 @@
let krate = tcx.hir.krate();
let mut cx = LateContext {
- tcx: tcx,
+ tcx,
tables: &ty::TypeckTables::empty(),
param_env: ty::ParamEnv::empty(Reveal::UserFacing),
- access_levels: access_levels,
+ access_levels,
lint_sess: LintSession::new(&tcx.sess.lint_store),
};
diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs
index e81d097..f9222ac 100644
--- a/src/librustc/lint/mod.rs
+++ b/src/librustc/lint/mod.rs
@@ -294,7 +294,7 @@
/// Get the `LintId` for a `Lint`.
pub fn of(lint: &'static Lint) -> LintId {
LintId {
- lint: lint,
+ lint,
}
}
diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs
index 7d62103..42f4c5c 100644
--- a/src/librustc/middle/dataflow.rs
+++ b/src/librustc/middle/dataflow.rs
@@ -260,16 +260,16 @@
let nodeid_to_index = build_nodeid_to_index(body, cfg);
DataFlowContext {
- tcx: tcx,
- analysis_name: analysis_name,
- words_per_id: words_per_id,
- nodeid_to_index: nodeid_to_index,
- bits_per_id: bits_per_id,
- oper: oper,
- gens: gens,
+ tcx,
+ analysis_name,
+ words_per_id,
+ nodeid_to_index,
+ bits_per_id,
+ oper,
+ gens,
action_kills: kills1,
scope_kills: kills2,
- on_entry: on_entry
+ on_entry,
}
}
diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs
index 77b4c97..2238e46 100644
--- a/src/librustc/middle/dead.rs
+++ b/src/librustc/middle/dead.rs
@@ -383,8 +383,8 @@
// Seed implemented trait items
let mut life_seeder = LifeSeeder {
- worklist: worklist,
- krate: krate,
+ worklist,
+ krate,
};
krate.visit_all_item_likes(&mut life_seeder);
@@ -397,8 +397,8 @@
-> Box<FxHashSet<ast::NodeId>> {
let worklist = create_and_seed_worklist(tcx, access_levels, krate);
let mut symbol_visitor = MarkSymbolVisitor {
- worklist: worklist,
- tcx: tcx,
+ worklist,
+ tcx,
tables: &ty::TypeckTables::empty(),
live_symbols: box FxHashSet(),
struct_has_extern_repr: false,
diff --git a/src/librustc/middle/effect.rs b/src/librustc/middle/effect.rs
index eab5a8f..abd5cbc 100644
--- a/src/librustc/middle/effect.rs
+++ b/src/librustc/middle/effect.rs
@@ -261,7 +261,7 @@
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
let mut visitor = EffectCheckVisitor {
- tcx: tcx,
+ tcx,
tables: &ty::TypeckTables::empty(),
body_id: hir::BodyId { node_id: ast::CRATE_NODE_ID },
unsafe_context: UnsafeContext::new(SafeContext),
diff --git a/src/librustc/middle/entry.rs b/src/librustc/middle/entry.rs
index b26cccf..31e054e 100644
--- a/src/librustc/middle/entry.rs
+++ b/src/librustc/middle/entry.rs
@@ -71,7 +71,7 @@
}
let mut ctxt = EntryContext {
- session: session,
+ session,
map: hir_map,
main_fn: None,
attr_main_fn: None,
diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs
index fde207e..d29622b 100644
--- a/src/librustc/middle/intrinsicck.rs
+++ b/src/librustc/middle/intrinsicck.rs
@@ -20,7 +20,7 @@
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
let mut visitor = ItemVisitor {
- tcx: tcx
+ tcx,
};
tcx.hir.krate().visit_all_item_likes(&mut visitor.as_deep_visitor());
}
diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs
index 3b506d7..01ed790 100644
--- a/src/librustc/middle/lang_items.rs
+++ b/src/librustc/middle/lang_items.rs
@@ -156,10 +156,10 @@
$( item_refs.insert($name, $variant as usize); )*
LanguageItemCollector {
- session: session,
- hir_map: hir_map,
+ session,
+ hir_map,
items: LanguageItems::new(),
- item_refs: item_refs,
+ item_refs,
}
}
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index c6a42be..551a550 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -269,7 +269,7 @@
impl<'a, 'tcx> IrMaps<'a, 'tcx> {
fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> IrMaps<'a, 'tcx> {
IrMaps {
- tcx: tcx,
+ tcx,
num_live_nodes: 0,
num_vars: 0,
live_node_map: NodeMap(),
@@ -385,7 +385,7 @@
ir.add_live_node_for_node(p_id, VarDefNode(sp));
ir.add_variable(Local(LocalInfo {
id: p_id,
- name: name
+ name,
}));
});
intravisit::walk_local(ir, local);
@@ -400,7 +400,7 @@
ir.add_live_node_for_node(p_id, VarDefNode(sp));
ir.add_variable(Local(LocalInfo {
id: p_id,
- name: name
+ name,
}));
})
}
@@ -534,8 +534,8 @@
let num_vars = ir.num_vars;
Liveness {
- ir: ir,
- tables: tables,
+ ir,
+ tables,
s: specials,
successors: vec![invalid_node(); num_live_nodes],
users: vec![invalid_users(); num_live_nodes * num_vars],
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs
index 5c741ec..557d4b2 100644
--- a/src/librustc/middle/mem_categorization.rs
+++ b/src/librustc/middle/mem_categorization.rs
@@ -656,8 +656,8 @@
Def::Local(def_id) => {
let vid = self.tcx.hir.as_local_node_id(def_id).unwrap();
Ok(Rc::new(cmt_ {
- id: id,
- span: span,
+ id,
+ span,
cat: Categorization::Local(vid),
mutbl: MutabilityCategory::from_local(self.tcx, vid),
ty: expr_ty,
@@ -706,7 +706,7 @@
None => span_bug!(span, "missing closure kind")
};
- let upvar_id = ty::UpvarId { var_id: var_id,
+ let upvar_id = ty::UpvarId { var_id,
closure_expr_id: fn_node_id };
let var_ty = self.node_ty(var_id)?;
@@ -717,8 +717,8 @@
// from the environment (perhaps we should eventually desugar
// this field further, but it will do for now).
let cmt_result = cmt_ {
- id: id,
- span: span,
+ id,
+ span,
cat: Categorization::Upvar(Upvar {id: upvar_id, kind: kind}),
mutbl: var_mutbl,
ty: var_ty,
@@ -743,7 +743,7 @@
// If this is a by-ref capture, then the upvar we loaded is
// actually a reference, so we have to add an implicit deref
// for that.
- let upvar_id = ty::UpvarId { var_id: var_id,
+ let upvar_id = ty::UpvarId { var_id,
closure_expr_id: fn_node_id };
let upvar_capture = self.tables.upvar_capture(upvar_id);
let cmt_result = match upvar_capture {
@@ -753,8 +753,8 @@
ty::UpvarCapture::ByRef(upvar_borrow) => {
let ptr = BorrowedPtr(upvar_borrow.kind, upvar_borrow.region);
cmt_ {
- id: id,
- span: span,
+ id,
+ span,
cat: Categorization::Deref(Rc::new(cmt_result), ptr),
mutbl: MutabilityCategory::from_borrow_kind(upvar_borrow.kind),
ty: var_ty,
@@ -813,8 +813,8 @@
}
let ret = cmt_ {
- id: id,
- span: span,
+ id,
+ span,
cat: Categorization::Deref(Rc::new(cmt_result), env_ptr),
mutbl: deref_mutbl,
ty: var_ty,
diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs
index c2f6914..df828c8 100644
--- a/src/librustc/middle/reachable.rs
+++ b/src/librustc/middle/reachable.rs
@@ -374,11 +374,11 @@
*ty == config::CrateTypeProcMacro
});
let mut reachable_context = ReachableContext {
- tcx: tcx,
+ tcx,
tables: &ty::TypeckTables::empty(),
reachable_symbols: NodeSet(),
worklist: Vec::new(),
- any_library: any_library,
+ any_library,
};
// Step 1: Seed the worklist with all nodes which were found to be public as
@@ -398,8 +398,8 @@
}
{
let mut collect_private_impl_items = CollectPrivateImplItemsVisitor {
- tcx: tcx,
- access_levels: access_levels,
+ tcx,
+ access_levels,
worklist: &mut reachable_context.worklist,
};
tcx.hir.krate().visit_all_item_likes(&mut collect_private_impl_items);
diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs
index b347a93..c4f7857 100644
--- a/src/librustc/middle/resolve_lifetime.rs
+++ b/src/librustc/middle/resolve_lifetime.rs
@@ -266,8 +266,8 @@
};
sess.track_errors(|| {
let mut visitor = LifetimeContext {
- sess: sess,
- hir_map: hir_map,
+ sess,
+ hir_map,
map: &mut map,
scope: ROOT_SCOPE,
trait_ref_hack: false,
@@ -341,7 +341,7 @@
Region::early(&mut index, def)
}).collect();
let scope = Scope::Binder {
- lifetimes: lifetimes,
+ lifetimes,
s: ROOT_SCOPE
};
self.with(scope, |old_scope, this| {
@@ -777,13 +777,13 @@
let xcrate_object_lifetime_defaults =
replace(&mut self.xcrate_object_lifetime_defaults, DefIdMap());
let mut this = LifetimeContext {
- sess: sess,
- hir_map: hir_map,
+ sess,
+ hir_map,
map: *map,
scope: &wrap_scope,
trait_ref_hack: self.trait_ref_hack,
- labels_in_fn: labels_in_fn,
- xcrate_object_lifetime_defaults: xcrate_object_lifetime_defaults,
+ labels_in_fn,
+ xcrate_object_lifetime_defaults,
};
debug!("entering scope {:?}", this.scope);
f(self.scope, &mut this);
@@ -849,7 +849,7 @@
}).collect();
let scope = Scope::Binder {
- lifetimes: lifetimes,
+ lifetimes,
s: self.scope
};
self.with(scope, move |old_scope, this| {
@@ -1206,7 +1206,7 @@
};
let scope = Scope::Elision {
- elide: elide,
+ elide,
s: self.scope
};
self.with(scope, |_, this| this.visit_ty(output));
@@ -1620,7 +1620,7 @@
map.issue_32330.insert(
lifetime.lifetime.id,
ty::Issue32330 {
- fn_def_id: fn_def_id,
+ fn_def_id,
region_name: name,
});
continue;
diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs
index e6dc5da..668a869 100644
--- a/src/librustc/middle/stability.rs
+++ b/src/librustc/middle/stability.rs
@@ -70,14 +70,14 @@
fn local(attr: Deprecation, id: DefId) -> DeprecationEntry {
assert!(id.is_local());
DeprecationEntry {
- attr: attr,
+ attr,
origin: Some(id.index),
}
}
fn external(attr: Deprecation) -> DeprecationEntry {
DeprecationEntry {
- attr: attr,
+ attr,
origin: None,
}
}
@@ -384,7 +384,7 @@
let krate = tcx.hir.krate();
let mut annotator = Annotator {
- tcx: tcx,
+ tcx,
index: self,
parent_stab: None,
parent_depr: None,
@@ -424,7 +424,7 @@
let mut staged_api = FxHashMap();
staged_api.insert(LOCAL_CRATE, is_staged_api);
Index {
- staged_api: staged_api,
+ staged_api,
stab_map: DefIdMap(),
depr_map: DefIdMap(),
active_features: FxHashSet(),
@@ -717,8 +717,8 @@
if tcx.stability.borrow().staged_api[&LOCAL_CRATE] {
let krate = tcx.hir.krate();
let mut missing = MissingStabilityAnnotations {
- tcx: tcx,
- access_levels: access_levels,
+ tcx,
+ access_levels,
};
missing.check_missing_stability(ast::CRATE_NODE_ID, krate.span);
intravisit::walk_crate(&mut missing, krate);
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index c8d03e7..96ccc3b 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -136,15 +136,15 @@
assert_eq!(local_decls[RETURN_POINTER].ty, return_ty);
Mir {
- basic_blocks: basic_blocks,
- visibility_scopes: visibility_scopes,
- promoted: promoted,
- return_ty: return_ty,
- local_decls: local_decls,
- arg_count: arg_count,
- upvar_decls: upvar_decls,
+ basic_blocks,
+ visibility_scopes,
+ promoted,
+ return_ty,
+ local_decls,
+ arg_count,
+ upvar_decls,
spread_arg: None,
- span: span,
+ span,
cache: cache::Cache::new()
}
}
@@ -395,10 +395,10 @@
pub fn new_temp(ty: Ty<'tcx>, span: Span) -> Self {
LocalDecl {
mutability: Mutability::Mut,
- ty: ty,
+ ty,
name: None,
source_info: SourceInfo {
- span: span,
+ span,
scope: ARGUMENT_VISIBILITY_SCOPE
},
is_user_variable: false
@@ -414,7 +414,7 @@
mutability: Mutability::Mut,
ty: return_ty,
source_info: SourceInfo {
- span: span,
+ span,
scope: ARGUMENT_VISIBILITY_SCOPE
},
name: None, // FIXME maybe we do want some name here?
@@ -629,7 +629,7 @@
pub fn new(terminator: Option<Terminator<'tcx>>) -> BasicBlockData<'tcx> {
BasicBlockData {
statements: vec![],
- terminator: terminator,
+ terminator,
is_cleanup: false,
}
}
@@ -941,7 +941,7 @@
pub fn elem(self, elem: LvalueElem<'tcx>) -> Lvalue<'tcx> {
Lvalue::Projection(Box::new(LvalueProjection {
base: self,
- elem: elem,
+ elem,
}))
}
}
@@ -1023,7 +1023,7 @@
span: Span,
) -> Self {
Operand::Constant(box Constant {
- span: span,
+ span,
ty: tcx.type_of(def_id).subst(tcx, substs),
literal: Literal::Value { value: ConstVal::Function(def_id, substs) },
})
@@ -1470,7 +1470,7 @@
Assign(ref lval, ref rval) => Assign(lval.fold_with(folder), rval.fold_with(folder)),
SetDiscriminant { ref lvalue, variant_index } => SetDiscriminant {
lvalue: lvalue.fold_with(folder),
- variant_index: variant_index
+ variant_index,
},
StorageLive(ref lval) => StorageLive(lval.fold_with(folder)),
StorageDead(ref lval) => StorageDead(lval.fold_with(folder)),
@@ -1490,7 +1490,7 @@
};
Statement {
source_info: self.source_info,
- kind: kind
+ kind,
}
}
@@ -1530,14 +1530,14 @@
},
Drop { ref location, target, unwind } => Drop {
location: location.fold_with(folder),
- target: target,
- unwind: unwind
+ target,
+ unwind,
},
DropAndReplace { ref location, ref value, target, unwind } => DropAndReplace {
location: location.fold_with(folder),
value: value.fold_with(folder),
- target: target,
- unwind: unwind
+ target,
+ unwind,
},
Call { ref func, ref args, ref destination, cleanup } => {
let dest = destination.as_ref().map(|&(ref loc, dest)| {
@@ -1548,7 +1548,7 @@
func: func.fold_with(folder),
args: args.fold_with(folder),
destination: dest,
- cleanup: cleanup
+ cleanup,
}
},
Assert { ref cond, expected, ref msg, target, cleanup } => {
@@ -1562,10 +1562,10 @@
};
Assert {
cond: cond.fold_with(folder),
- expected: expected,
- msg: msg,
- target: target,
- cleanup: cleanup
+ expected,
+ msg,
+ target,
+ cleanup,
}
},
Resume => Resume,
@@ -1574,7 +1574,7 @@
};
Terminator {
source_info: self.source_info,
- kind: kind
+ kind,
}
}
@@ -1716,8 +1716,8 @@
};
Projection {
- base: base,
- elem: elem
+ base,
+ elem,
}
}
@@ -1750,7 +1750,7 @@
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
match *self {
Literal::Item { def_id, substs } => Literal::Item {
- def_id: def_id,
+ def_id,
substs: substs.fold_with(folder)
},
_ => self.clone()
diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs
index 6078778..71acb36 100644
--- a/src/librustc/mir/tcx.rs
+++ b/src/librustc/mir/tcx.rs
@@ -58,7 +58,7 @@
})
.ty;
LvalueTy::Ty {
- ty: ty,
+ ty,
}
}
ProjectionElem::Index(_) | ProjectionElem::ConstantIndex { .. } =>
@@ -85,8 +85,8 @@
assert!(adt_def.is_enum());
assert!(index < adt_def.variants.len());
assert_eq!(adt_def, adt_def1);
- LvalueTy::Downcast { adt_def: adt_def,
- substs: substs,
+ LvalueTy::Downcast { adt_def,
+ substs,
variant_index: index }
}
_ => {
@@ -104,9 +104,9 @@
LvalueTy::Ty { ty } => LvalueTy::Ty { ty: ty.fold_with(folder) },
LvalueTy::Downcast { adt_def, substs, variant_index } => {
LvalueTy::Downcast {
- adt_def: adt_def,
+ adt_def,
substs: substs.fold_with(folder),
- variant_index: variant_index
+ variant_index,
}
}
}
diff --git a/src/librustc/mir/traversal.rs b/src/librustc/mir/traversal.rs
index 6057e7e..5aab46b 100644
--- a/src/librustc/mir/traversal.rs
+++ b/src/librustc/mir/traversal.rs
@@ -44,9 +44,9 @@
let worklist = vec![root];
Preorder {
- mir: mir,
+ mir,
visited: BitVector::new(mir.basic_blocks().len()),
- worklist: worklist
+ worklist,
}
}
}
@@ -106,7 +106,7 @@
impl<'a, 'tcx> Postorder<'a, 'tcx> {
pub fn new(mir: &'a Mir<'tcx>, root: BasicBlock) -> Postorder<'a, 'tcx> {
let mut po = Postorder {
- mir: mir,
+ mir,
visited: BitVector::new(mir.basic_blocks().len()),
visit_stack: Vec::new()
};
@@ -251,8 +251,8 @@
let len = blocks.len();
ReversePostorder {
- mir: mir,
- blocks: blocks,
+ mir,
+ blocks,
idx: len
}
}
diff --git a/src/librustc/session/code_stats.rs b/src/librustc/session/code_stats.rs
index 215539d..118b841 100644
--- a/src/librustc/session/code_stats.rs
+++ b/src/librustc/session/code_stats.rs
@@ -82,12 +82,12 @@
opt_discr_size: Option<Size>,
variants: Vec<VariantInfo>) {
let info = TypeSizeInfo {
- kind: kind,
+ kind,
type_description: type_desc.to_string(),
align: align.abi(),
overall_size: overall_size.bytes(),
opt_discr_size: opt_discr_size.map(|s| s.bytes()),
- variants: variants,
+ variants,
};
self.type_sizes.insert(info);
}
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 4f7ad5e..240f000 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -1122,9 +1122,9 @@
};
Config {
- target: target,
- int_type: int_type,
- uint_type: uint_type,
+ target,
+ int_type,
+ uint_type,
}
}
@@ -1150,7 +1150,7 @@
where F: Fn(&mut getopts::Options) -> &mut getopts::Options + 'static,
{
RustcOptGroup {
- name: name,
+ name,
apply: Box::new(f),
stability: OptionStability::Stable,
}
@@ -1160,7 +1160,7 @@
where F: Fn(&mut getopts::Options) -> &mut getopts::Options + 'static,
{
RustcOptGroup {
- name: name,
+ name,
apply: Box::new(f),
stability: OptionStability::Unstable,
}
@@ -1627,28 +1627,28 @@
let incremental = debugging_opts.incremental.as_ref().map(|m| PathBuf::from(m));
(Options {
- crate_types: crate_types,
+ crate_types,
optimize: opt_level,
- debuginfo: debuginfo,
- lint_opts: lint_opts,
- lint_cap: lint_cap,
- describe_lints: describe_lints,
+ debuginfo,
+ lint_opts,
+ lint_cap,
+ describe_lints,
output_types: OutputTypes(output_types),
- search_paths: search_paths,
+ search_paths,
maybe_sysroot: sysroot_opt,
target_triple: target,
- test: test,
- incremental: incremental,
- debugging_opts: debugging_opts,
- prints: prints,
- cg: cg,
- error_format: error_format,
+ test,
+ incremental,
+ debugging_opts,
+ prints,
+ cg,
+ error_format,
externs: Externs(externs),
- crate_name: crate_name,
+ crate_name,
alt_std_name: None,
- libs: libs,
+ libs,
unstable_features: UnstableFeatures::from_environment(),
- debug_assertions: debug_assertions,
+ debug_assertions,
actually_rustdoc: false,
},
cfg)
diff --git a/src/librustc/session/filesearch.rs b/src/librustc/session/filesearch.rs
index 47b988a..1004b28 100644
--- a/src/librustc/session/filesearch.rs
+++ b/src/librustc/session/filesearch.rs
@@ -104,10 +104,10 @@
kind: PathKind) -> FileSearch<'a> {
debug!("using sysroot = {}, triple = {}", sysroot.display(), triple);
FileSearch {
- sysroot: sysroot,
- search_paths: search_paths,
- triple: triple,
- kind: kind,
+ sysroot,
+ search_paths,
+ triple,
+ kind,
}
}
diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs
index 39a719f..fe6b24f 100644
--- a/src/librustc/session/mod.rs
+++ b/src/librustc/session/mod.rs
@@ -485,7 +485,7 @@
*incr_comp_session = IncrCompSession::Active {
session_directory: session_dir,
- lock_file: lock_file,
+ lock_file,
};
}
@@ -515,7 +515,7 @@
// Note: This will also drop the lock file, thus unlocking the directory
*incr_comp_session = IncrCompSession::InvalidBecauseOfErrors {
- session_directory: session_directory
+ session_directory,
};
}
@@ -695,18 +695,18 @@
let sess = Session {
dep_graph: dep_graph.clone(),
target: target_cfg,
- host: host,
+ host,
opts: sopts,
- cstore: cstore,
+ cstore,
parse_sess: p_s,
// For a library crate, this is always none
entry_fn: RefCell::new(None),
entry_type: Cell::new(None),
plugin_registrar_fn: Cell::new(None),
derive_registrar_fn: Cell::new(None),
- default_sysroot: default_sysroot,
- local_crate_source_file: local_crate_source_file,
- working_dir: working_dir,
+ default_sysroot,
+ local_crate_source_file,
+ working_dir,
lint_store: RefCell::new(lint::LintStore::new()),
lints: RefCell::new(lint::LintTable::new()),
one_time_diagnostics: RefCell::new(FxHashSet()),
@@ -733,10 +733,10 @@
decode_def_path_tables_time: Cell::new(Duration::from_secs(0)),
},
code_stats: RefCell::new(CodeStats::new()),
- optimization_fuel_crate: optimization_fuel_crate,
- optimization_fuel_limit: optimization_fuel_limit,
- print_fuel_crate: print_fuel_crate,
- print_fuel: print_fuel,
+ optimization_fuel_crate,
+ optimization_fuel_limit,
+ print_fuel_crate,
+ print_fuel,
out_of_fuel: Cell::new(false),
// Note that this is unsafe because it may misinterpret file descriptors
// on Unix as jobserver file descriptors. We hopefully execute this near
diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs
index 54fe3a4..34df447 100644
--- a/src/librustc/traits/coherence.rs
+++ b/src/librustc/traits/coherence.rs
@@ -47,7 +47,7 @@
let impl_substs = selcx.infcx().fresh_substs_for_item(DUMMY_SP, impl_def_id);
let header = ty::ImplHeader {
- impl_def_id: impl_def_id,
+ impl_def_id,
self_ty: tcx.type_of(impl_def_id),
trait_ref: tcx.impl_trait_ref(impl_def_id),
predicates: tcx.predicates_of(impl_def_id).predicates
@@ -102,7 +102,7 @@
.chain(&b_impl_header.predicates)
.map(|p| infcx.resolve_type_vars_if_possible(p))
.map(|p| Obligation { cause: ObligationCause::dummy(),
- param_env: param_env,
+ param_env,
recursion_depth: 0,
predicate: p })
.chain(obligations)
diff --git a/src/librustc/traits/fulfill.rs b/src/librustc/traits/fulfill.rs
index 16ecc94..d0bb1ad 100644
--- a/src/librustc/traits/fulfill.rs
+++ b/src/librustc/traits/fulfill.rs
@@ -152,11 +152,11 @@
cause: ObligationCause<'tcx>)
{
let trait_ref = ty::TraitRef {
- def_id: def_id,
+ def_id,
substs: infcx.tcx.mk_substs_trait(ty, &[]),
};
self.register_predicate_obligation(infcx, Obligation {
- cause: cause,
+ cause,
recursion_depth: 0,
param_env,
predicate: trait_ref.to_predicate()
@@ -191,7 +191,7 @@
}
self.predicates.register_obligation(PendingPredicateObligation {
- obligation: obligation,
+ obligation,
stalled_on: vec![]
});
}
@@ -259,7 +259,7 @@
// Process pending obligations.
let outcome = self.predicates.process_obligations(&mut FulfillProcessor {
- selcx: selcx,
+ selcx,
region_obligations: &mut self.region_obligations,
});
debug!("select: outcome={:?}", outcome);
@@ -606,7 +606,7 @@
pub fn new(dep_graph: DepGraph) -> GlobalFulfilledPredicates<'gcx> {
GlobalFulfilledPredicates {
set: FxHashSet(),
- dep_graph: dep_graph,
+ dep_graph,
}
}
diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs
index 16c41c8..6b243ff 100644
--- a/src/librustc/traits/mod.rs
+++ b/src/librustc/traits/mod.rs
@@ -396,7 +396,7 @@
infcx.tcx.item_path_str(def_id));
let trait_ref = ty::TraitRef {
- def_id: def_id,
+ def_id,
substs: infcx.tcx.mk_substs_trait(ty, &[]),
};
let obligation = Obligation {
diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs
index c356e53..14b6d46 100644
--- a/src/librustc/traits/project.rs
+++ b/src/librustc/traits/project.rs
@@ -245,11 +245,11 @@
-> AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx>
{
AssociatedTypeNormalizer {
- selcx: selcx,
- param_env: param_env,
- cause: cause,
+ selcx,
+ param_env,
+ cause,
obligations: vec![],
- depth: depth,
+ depth,
}
}
@@ -371,7 +371,7 @@
let ty_var = selcx.infcx().next_ty_var(
TypeVariableOrigin::NormalizeProjectionType(tcx.def_span(def_id)));
let projection = ty::Binder(ty::ProjectionPredicate {
- projection_ty: projection_ty,
+ projection_ty,
ty: ty_var
});
let obligation = Obligation::with_depth(
@@ -514,12 +514,12 @@
obligations.extend(normalizer.obligations);
Normalized {
value: normalized_ty,
- obligations: obligations,
+ obligations,
}
} else {
Normalized {
value: projected_ty,
- obligations: obligations,
+ obligations,
}
};
infcx.projection_cache.borrow_mut()
@@ -586,7 +586,7 @@
-> NormalizedTy<'tcx>
{
let trait_ref = projection_ty.trait_ref.to_poly_trait_ref();
- let trait_obligation = Obligation { cause: cause,
+ let trait_obligation = Obligation { cause,
recursion_depth: depth,
param_env,
predicate: trait_ref.to_predicate() };
@@ -1232,7 +1232,7 @@
Ok(InferOk { value: ty_match, obligations }) => {
Progress {
ty: ty_match.value,
- obligations: obligations,
+ obligations,
cacheable: ty_match.unconstrained_regions.is_empty(),
}
}
@@ -1306,7 +1306,7 @@
if item.kind == ty::AssociatedKind::Type && item.name == assoc_ty_name {
return specialization_graph::NodeItem {
node: specialization_graph::Node::Impl(impl_def_id),
- item: item,
+ item,
};
}
}
diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs
index 856fea7..4d4693f 100644
--- a/src/librustc/traits/select.rs
+++ b/src/librustc/traits/select.rs
@@ -212,7 +212,7 @@
Some(match *self {
BuiltinCandidate { has_nested } => {
BuiltinCandidate {
- has_nested: has_nested
+ has_nested,
}
}
ImplCandidate(def_id) => ImplCandidate(def_id),
@@ -290,7 +290,7 @@
impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
pub fn new(infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>) -> SelectionContext<'cx, 'gcx, 'tcx> {
SelectionContext {
- infcx: infcx,
+ infcx,
freshener: infcx.freshener(),
intercrate: false,
inferred_obligations: SnapshotVec::new(),
@@ -299,7 +299,7 @@
pub fn intercrate(infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>) -> SelectionContext<'cx, 'gcx, 'tcx> {
SelectionContext {
- infcx: infcx,
+ infcx,
freshener: infcx.freshener(),
intercrate: true,
inferred_obligations: SnapshotVec::new(),
@@ -2205,7 +2205,7 @@
debug!("vtable_default_impl: obligations={:?}", obligations);
VtableDefaultImplData {
- trait_def_id: trait_def_id,
+ trait_def_id,
nested: obligations
}
}
@@ -2273,7 +2273,7 @@
// e.g. `impl<U: Tr, V: Iterator<Item=U>> Foo<<U as Tr>::T> for V`
impl_obligations.append(&mut substs.obligations);
- VtableImplData { impl_def_id: impl_def_id,
+ VtableImplData { impl_def_id,
substs: substs.value,
nested: impl_obligations }
}
@@ -2336,7 +2336,7 @@
VtableObjectData {
upcast_trait_ref: upcast_trait_ref.unwrap(),
- vtable_base: vtable_base,
+ vtable_base,
nested: vec![]
}
}
@@ -2405,7 +2405,7 @@
ty::Predicate::ClosureKind(closure_def_id, kind)));
Ok(VtableClosureData {
- closure_def_id: closure_def_id,
+ closure_def_id,
substs: substs.clone(),
nested: obligations
})
@@ -2826,8 +2826,8 @@
obligation.predicate.to_poly_trait_ref().fold_with(&mut self.freshener);
TraitObligationStack {
- obligation: obligation,
- fresh_trait_ref: fresh_trait_ref,
+ obligation,
+ fresh_trait_ref,
previous: previous_stack,
}
}
@@ -2911,7 +2911,7 @@
predicate.obligations.into_iter().chain(
Some(Obligation {
cause: cause.clone(),
- recursion_depth: recursion_depth,
+ recursion_depth,
param_env,
predicate: predicate.value
}))
diff --git a/src/librustc/traits/structural_impls.rs b/src/librustc/traits/structural_impls.rs
index c4479e6..f1c1765 100644
--- a/src/librustc/traits/structural_impls.rs
+++ b/src/librustc/traits/structural_impls.rs
@@ -209,15 +209,15 @@
trait_item_def_id,
lint_id } => {
Some(super::CompareImplMethodObligation {
- item_name: item_name,
- impl_item_def_id: impl_item_def_id,
- trait_item_def_id: trait_item_def_id,
- lint_id: lint_id,
+ item_name,
+ impl_item_def_id,
+ trait_item_def_id,
+ lint_id,
})
}
super::ExprAssignable => Some(super::ExprAssignable),
super::MatchExpressionArm { arm_span, source } => {
- Some(super::MatchExpressionArm { arm_span: arm_span,
+ Some(super::MatchExpressionArm { arm_span,
source: source })
}
super::IfExpression => Some(super::IfExpression),
@@ -253,7 +253,7 @@
traits::ObligationCause {
span: self.span,
body_id: self.body_id,
- code: code,
+ code,
}
})
}
@@ -271,9 +271,9 @@
}) => {
tcx.lift(&substs).map(|substs| {
traits::VtableImpl(traits::VtableImplData {
- impl_def_id: impl_def_id,
- substs: substs,
- nested: nested
+ impl_def_id,
+ substs,
+ nested,
})
})
}
@@ -285,17 +285,17 @@
}) => {
tcx.lift(&substs).map(|substs| {
traits::VtableClosure(traits::VtableClosureData {
- closure_def_id: closure_def_id,
- substs: substs,
- nested: nested
+ closure_def_id,
+ substs,
+ nested,
})
})
}
traits::VtableFnPointer(traits::VtableFnPointerData { fn_ty, nested }) => {
tcx.lift(&fn_ty).map(|fn_ty| {
traits::VtableFnPointer(traits::VtableFnPointerData {
- fn_ty: fn_ty,
- nested: nested,
+ fn_ty,
+ nested,
})
})
}
@@ -309,8 +309,8 @@
tcx.lift(&upcast_trait_ref).map(|trait_ref| {
traits::VtableObject(traits::VtableObjectData {
upcast_trait_ref: trait_ref,
- vtable_base: vtable_base,
- nested: nested
+ vtable_base,
+ nested,
})
})
}
diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs
index c3859278..dae0c89 100644
--- a/src/librustc/traits/util.rs
+++ b/src/librustc/traits/util.rs
@@ -288,7 +288,7 @@
-> SupertraitDefIds<'cx, 'gcx, 'tcx>
{
SupertraitDefIds {
- tcx: tcx,
+ tcx,
stack: vec![trait_def_id],
visited: Some(trait_def_id).into_iter().collect(),
}
@@ -399,8 +399,8 @@
generic_bounds.predicates.iter().map(|predicate| {
Obligation { cause: cause.clone(),
- recursion_depth: recursion_depth,
- param_env: param_env,
+ recursion_depth,
+ param_env,
predicate: predicate.clone() }
}).collect()
}
@@ -413,9 +413,9 @@
-> PredicateObligation<'tcx>
{
Obligation {
- cause: cause,
- param_env: param_env,
- recursion_depth: recursion_depth,
+ cause,
+ param_env,
+ recursion_depth,
predicate: trait_ref.to_predicate(),
}
}
diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs
index 5f869fc..316f871 100644
--- a/src/librustc/ty/context.rs
+++ b/src/librustc/ty/context.rs
@@ -107,7 +107,7 @@
impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
fn new(arena: &'tcx DroplessArena) -> CtxtInterners<'tcx> {
CtxtInterners {
- arena: arena,
+ arena,
type_: RefCell::new(FxHashSet()),
type_list: RefCell::new(FxHashSet()),
substs: RefCell::new(FxHashSet()),
@@ -732,12 +732,12 @@
global_interners: interners,
dep_graph: dep_graph.clone(),
types: common_types,
- named_region_map: named_region_map,
+ named_region_map,
trait_map: resolutions.trait_map,
export_map: resolutions.export_map,
fulfilled_predicates: RefCell::new(fulfilled_predicates),
- hir: hir,
- def_path_hash_to_def_id: def_path_hash_to_def_id,
+ hir,
+ def_path_hash_to_def_id,
maps: maps::Maps::new(providers),
mir_passes,
freevars: RefCell::new(resolutions.freevars),
@@ -745,7 +745,7 @@
rcache: RefCell::new(FxHashMap()),
normalized_cache: RefCell::new(FxHashMap()),
inhabitedness_cache: RefCell::new(FxHashMap()),
- lang_items: lang_items,
+ lang_items,
used_unsafe: RefCell::new(NodeSet()),
used_mut_nodes: RefCell::new(NodeSet()),
stability: RefCell::new(stability),
@@ -753,7 +753,7 @@
evaluation_cache: traits::EvaluationCache::new(),
rvalue_promotable_to_static: RefCell::new(NodeMap()),
crate_name: Symbol::intern(crate_name),
- data_layout: data_layout,
+ data_layout,
layout_interner: RefCell::new(FxHashSet()),
layout_depth: Cell::new(0),
derive_macros: RefCell::new(NodeMap()),
@@ -964,8 +964,8 @@
let prev = tls.get();
tls.set(Some((gcx_ptr, interners_ptr)));
let ret = f(TyCtxt {
- gcx: gcx,
- interners: interners
+ gcx,
+ interners,
});
tls.set(prev);
ret
@@ -980,8 +980,8 @@
let gcx = unsafe { &*(gcx as *const GlobalCtxt) };
let interners = unsafe { &*(interners as *const CtxtInterners) };
f(TyCtxt {
- gcx: gcx,
- interners: interners
+ gcx,
+ interners,
})
})
}
@@ -1408,7 +1408,7 @@
substs: &'tcx Substs<'tcx>)
-> Ty<'tcx> {
self.mk_closure_from_closure_substs(closure_id, ClosureSubsts {
- substs: substs
+ substs,
})
}
diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs
index bb13031..6686804 100644
--- a/src/librustc/ty/fold.rs
+++ b/src/librustc/ty/fold.rs
@@ -238,10 +238,10 @@
where F : FnMut(ty::Region<'tcx>, u32) -> ty::Region<'tcx>
{
RegionFolder {
- tcx: tcx,
- skipped_regions: skipped_regions,
+ tcx,
+ skipped_regions,
current_depth: 1,
- fld_r: fld_r,
+ fld_r,
}
}
}
@@ -393,9 +393,9 @@
where F : FnMut(ty::BoundRegion) -> ty::Region<'tcx>
{
RegionReplacer {
- tcx: tcx,
+ tcx,
current_depth: 1,
- fld_r: fld_r,
+ fld_r,
map: FxHashMap()
}
}
@@ -621,7 +621,7 @@
LateBoundRegionsCollector {
current_depth: 1,
regions: FxHashSet(),
- just_constrained: just_constrained,
+ just_constrained,
}
}
}
diff --git a/src/librustc/ty/inhabitedness/def_id_forest.rs b/src/librustc/ty/inhabitedness/def_id_forest.rs
index 6801e82..231600f 100644
--- a/src/librustc/ty/inhabitedness/def_id_forest.rs
+++ b/src/librustc/ty/inhabitedness/def_id_forest.rs
@@ -52,7 +52,7 @@
let mut root_ids = SmallVec::new();
root_ids.push(id);
DefIdForest {
- root_ids: root_ids,
+ root_ids,
}
}
diff --git a/src/librustc/ty/item_path.rs b/src/librustc/ty/item_path.rs
index b9896e0..73b577e 100644
--- a/src/librustc/ty/item_path.rs
+++ b/src/librustc/ty/item_path.rs
@@ -397,7 +397,7 @@
impl LocalPathBuffer {
fn new(root_mode: RootMode) -> LocalPathBuffer {
LocalPathBuffer {
- root_mode: root_mode,
+ root_mode,
str: String::new(),
}
}
diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs
index e1aa890..3212c6f 100644
--- a/src/librustc/ty/layout.rs
+++ b/src/librustc/ty/layout.rs
@@ -609,7 +609,7 @@
};
let mut ret = Struct {
- align: align,
+ align,
primitive_align: align,
packed: repr.packed(),
sized: true,
@@ -910,10 +910,10 @@
fn new(dl: &TargetDataLayout, packed: bool) -> Union {
let align = if packed { dl.i8_align } else { dl.aggregate_align };
Union {
- align: align,
+ align,
primitive_align: align,
min_size: Size::from_bytes(0),
- packed: packed,
+ packed,
}
}
@@ -1169,8 +1169,8 @@
sized: true,
align: element.align(dl),
primitive_align: element.primitive_align(dl),
- element_size: element_size,
- count: count
+ element_size,
+ count,
}
}
ty::TySlice(element) => {
@@ -1280,9 +1280,9 @@
// grok.
let (discr, signed) = Integer::repr_discr(tcx, ty, &def.repr, min, max);
return success(CEnum {
- discr: discr,
- signed: signed,
- non_zero: non_zero,
+ discr,
+ signed,
+ non_zero,
// FIXME: should be u128?
min: min as u64,
max: max as u64
@@ -1364,7 +1364,7 @@
};
return success(RawNullablePointer {
nndiscr: discr as u64,
- value: value,
+ value,
});
}
@@ -1491,10 +1491,10 @@
General {
discr: ity,
- variants: variants,
- size: size,
- align: align,
- primitive_align: primitive_align
+ variants,
+ size,
+ align,
+ primitive_align,
}
}
@@ -1957,7 +1957,7 @@
ty::TyParam(_) | ty::TyProjection(_) => {
assert!(tail.has_param_types() || tail.has_self_ty());
Ok(SizeSkeleton::Pointer {
- non_zero: non_zero,
+ non_zero,
tail: tcx.erase_regions(&tail)
})
}
@@ -2016,7 +2016,7 @@
return Ok(SizeSkeleton::Pointer {
non_zero: non_zero ||
Some(def.did) == tcx.lang_items.non_zero(),
- tail: tail
+ tail,
});
} else {
return Err(err);
@@ -2030,7 +2030,7 @@
(None, Some(SizeSkeleton::Pointer { non_zero: true, tail })) => {
Ok(SizeSkeleton::Pointer {
non_zero: false,
- tail: tail
+ tail,
})
}
_ => Err(err)
@@ -2115,7 +2115,7 @@
let ty = self.normalize_projections(ty);
Ok(TyLayout {
- ty: ty,
+ ty,
layout: ty.layout(self.tcx, self.param_env)?,
variant_index: None
})
diff --git a/src/librustc/ty/maps.rs b/src/librustc/ty/maps.rs
index a6c59d4..f4e3332 100644
--- a/src/librustc/ty/maps.rs
+++ b/src/librustc/ty/maps.rs
@@ -246,7 +246,7 @@
if let Some((i, _)) = stack.iter().enumerate().rev()
.find(|&(_, &(_, ref q))| *q == query) {
return Err(CycleError {
- span: span,
+ span,
cycle: RefMut::map(stack, |stack| &mut stack[i..])
});
}
diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs
index 548ee7b..88aef53 100644
--- a/src/librustc/ty/mod.rs
+++ b/src/librustc/ty/mod.rs
@@ -964,8 +964,8 @@
.next()
.unwrap_or(trait_def_id);
DepNode::new(tcx, DepConstructor::TraitSelect {
- trait_def_id: trait_def_id,
- input_def_id: input_def_id
+ trait_def_id,
+ input_def_id,
})
}
@@ -1244,12 +1244,12 @@
if value.has_param_types() || value.has_self_ty() {
ParamEnvAnd {
param_env: self,
- value: value,
+ value,
}
} else {
ParamEnvAnd {
param_env: ParamEnv::empty(self.reveal),
- value: value,
+ value,
}
}
}
@@ -1487,10 +1487,10 @@
AdtKind::Struct => {}
}
AdtDef {
- did: did,
- variants: variants,
- flags: flags,
- repr: repr,
+ did,
+ variants,
+ flags,
+ repr,
}
}
@@ -2113,11 +2113,11 @@
AssociatedItem {
name: trait_item_ref.name,
- kind: kind,
+ kind,
// Visibility of trait items is inherited from their traits.
vis: Visibility::from_hir(parent_vis, trait_item_ref.id.node_id, self),
defaultness: trait_item_ref.defaultness,
- def_id: def_id,
+ def_id,
container: TraitContainer(parent_def_id),
method_has_self_argument: has_self
}
@@ -2138,11 +2138,11 @@
ty::AssociatedItem {
name: impl_item_ref.name,
- kind: kind,
+ kind,
// Visibility of trait impl items doesn't matter.
vis: ty::Visibility::from_hir(&impl_item_ref.vis, impl_item_ref.id.node_id, self),
defaultness: impl_item_ref.defaultness,
- def_id: def_id,
+ def_id,
container: ImplContainer(parent_def_id),
method_has_self_argument: has_self
}
diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs
index 2e97805..7710cc9 100644
--- a/src/librustc/ty/relate.rs
+++ b/src/librustc/ty/relate.rs
@@ -182,8 +182,8 @@
Ok(ty::FnSig {
inputs_and_output: relation.tcx().intern_type_list(&inputs_and_output),
variadic: a.variadic,
- unsafety: unsafety,
- abi: abi
+ unsafety,
+ abi,
})
}
}
@@ -250,9 +250,9 @@
let trait_ref = relation.relate(&a.trait_ref, &b.trait_ref)?;
let ty = relation.relate(&a.ty, &b.ty)?;
Ok(ty::ExistentialProjection {
- trait_ref: trait_ref,
+ trait_ref,
item_name: a.item_name,
- ty: ty
+ ty,
})
}
}
diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs
index d052629..478717e 100644
--- a/src/librustc/ty/structural_impls.rs
+++ b/src/librustc/ty/structural_impls.rs
@@ -78,7 +78,7 @@
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
tcx.lift(&self.substs).map(|substs| ty::TraitRef {
def_id: self.def_id,
- substs: substs
+ substs,
})
}
}
@@ -88,7 +88,7 @@
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
tcx.lift(&self.substs).map(|substs| ty::ExistentialTraitRef {
def_id: self.def_id,
- substs: substs
+ substs,
})
}
}
@@ -98,7 +98,7 @@
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>)
-> Option<ty::TraitPredicate<'tcx>> {
tcx.lift(&self.trait_ref).map(|trait_ref| ty::TraitPredicate {
- trait_ref: trait_ref
+ trait_ref,
})
}
}
@@ -117,8 +117,8 @@
-> Option<ty::SubtypePredicate<'tcx>> {
tcx.lift(&(self.a, self.b)).map(|(a, b)| ty::SubtypePredicate {
a_is_expected: self.a_is_expected,
- a: a,
- b: b,
+ a,
+ b,
})
}
}
@@ -146,8 +146,8 @@
-> Option<ty::ProjectionPredicate<'tcx>> {
tcx.lift(&(self.projection_ty, self.ty)).map(|(projection_ty, ty)| {
ty::ProjectionPredicate {
- projection_ty: projection_ty,
- ty: ty
+ projection_ty,
+ ty,
}
})
}
@@ -158,9 +158,9 @@
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
tcx.lift(&(self.trait_ref, self.ty)).map(|(trait_ref, ty)| {
ty::ExistentialProjection {
- trait_ref: trait_ref,
+ trait_ref,
item_name: self.item_name,
- ty: ty
+ ty,
}
})
}
@@ -300,8 +300,8 @@
tcx.lift(&self.expected).and_then(|expected| {
tcx.lift(&self.found).map(|found| {
ty::error::ExpectedFound {
- expected: expected,
- found: found
+ expected,
+ found,
}
})
})
@@ -313,7 +313,7 @@
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
tcx.lift(&self.ty).map(|ty| {
type_variable::Default {
- ty: ty,
+ ty,
origin_span: self.origin_span,
def_id: self.def_id
}
diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs
index 452775e..737e69b 100644
--- a/src/librustc/ty/sty.rs
+++ b/src/librustc/ty/sty.rs
@@ -571,8 +571,8 @@
|item| item.name == item_name).unwrap().def_id;
ProjectionTy {
- trait_ref: trait_ref,
- item_def_id: item_def_id,
+ trait_ref,
+ item_def_id,
}
}
diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs
index d0d6132..f6112d4 100644
--- a/src/librustc/ty/subst.rs
+++ b/src/librustc/ty/subst.rs
@@ -352,9 +352,9 @@
span: Option<Span>)
-> T
{
- let mut folder = SubstFolder { tcx: tcx,
- substs: substs,
- span: span,
+ let mut folder = SubstFolder { tcx,
+ substs,
+ span,
root_ty: None,
ty_stack_depth: 0,
region_binders_passed: 0 };
diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs
index 2eb0aca..91bc561 100644
--- a/src/librustc/ty/wf.rs
+++ b/src/librustc/ty/wf.rs
@@ -31,10 +31,10 @@
span: Span)
-> Option<Vec<traits::PredicateObligation<'tcx>>>
{
- let mut wf = WfPredicates { infcx: infcx,
- param_env: param_env,
- body_id: body_id,
- span: span,
+ let mut wf = WfPredicates { infcx,
+ param_env,
+ body_id,
+ span,
out: vec![] };
if wf.compute(ty) {
debug!("wf::obligations({:?}, body_id={:?}) = {:?}", ty, body_id, wf.out);