Don't redundantly repeat field names (clippy::redundant_field_names)
This commit is contained in:
parent
865b44a3e3
commit
83980aca20
61 changed files with 88 additions and 100 deletions
|
@ -959,7 +959,7 @@ impl<T> LinkedList<T> {
|
|||
let it = self.head;
|
||||
let old_len = self.len;
|
||||
|
||||
DrainFilter { list: self, it: it, pred: filter, idx: 0, old_len: old_len }
|
||||
DrainFilter { list: self, it, pred: filter, idx: 0, old_len }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1659,7 +1659,7 @@ struct SetLenOnDrop<'a> {
|
|||
impl<'a> SetLenOnDrop<'a> {
|
||||
#[inline]
|
||||
fn new(len: &'a mut usize) -> Self {
|
||||
SetLenOnDrop { local_len: *len, len: len }
|
||||
SetLenOnDrop { local_len: *len, len }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -55,13 +55,15 @@ pub struct Diagnostic {
|
|||
}
|
||||
|
||||
macro_rules! diagnostic_child_methods {
|
||||
($spanned:ident, $regular:ident, $level:expr) => (
|
||||
($spanned:ident, $regular:ident, $level:expr) => {
|
||||
/// Adds a new child diagnostic message to `self` with the level
|
||||
/// identified by this method's name with the given `spans` and
|
||||
/// `message`.
|
||||
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
|
||||
pub fn $spanned<S, T>(mut self, spans: S, message: T) -> Diagnostic
|
||||
where S: MultiSpan, T: Into<String>
|
||||
where
|
||||
S: MultiSpan,
|
||||
T: Into<String>,
|
||||
{
|
||||
self.children.push(Diagnostic::spanned(spans, $level, message));
|
||||
self
|
||||
|
@ -74,7 +76,7 @@ macro_rules! diagnostic_child_methods {
|
|||
self.children.push(Diagnostic::new($level, message));
|
||||
self
|
||||
}
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
/// Iterator over the children diagnostics of a `Diagnostic`.
|
||||
|
@ -96,7 +98,7 @@ impl Diagnostic {
|
|||
/// Creates a new diagnostic with the given `level` and `message`.
|
||||
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
|
||||
pub fn new<T: Into<String>>(level: Level, message: T) -> Diagnostic {
|
||||
Diagnostic { level: level, message: message.into(), spans: vec![], children: vec![] }
|
||||
Diagnostic { level, message: message.into(), spans: vec![], children: vec![] }
|
||||
}
|
||||
|
||||
/// Creates a new diagnostic with the given `level` and `message` pointing to
|
||||
|
@ -107,12 +109,7 @@ impl Diagnostic {
|
|||
S: MultiSpan,
|
||||
T: Into<String>,
|
||||
{
|
||||
Diagnostic {
|
||||
level: level,
|
||||
message: message.into(),
|
||||
spans: spans.into_spans(),
|
||||
children: vec![],
|
||||
}
|
||||
Diagnostic { level, message: message.into(), spans: spans.into_spans(), children: vec![] }
|
||||
}
|
||||
|
||||
diagnostic_child_methods!(span_error, error, Level::Error);
|
||||
|
|
|
@ -192,7 +192,7 @@ impl DefPath {
|
|||
}
|
||||
}
|
||||
data.reverse();
|
||||
DefPath { data: data, krate: krate }
|
||||
DefPath { data, krate }
|
||||
}
|
||||
|
||||
/// Returns a string representation of the `DefPath` without
|
||||
|
|
|
@ -258,7 +258,7 @@ pub enum Visibility {
|
|||
|
||||
impl<'tcx> CodegenUnit<'tcx> {
|
||||
pub fn new(name: Symbol) -> CodegenUnit<'tcx> {
|
||||
CodegenUnit { name: name, items: Default::default(), size_estimate: None }
|
||||
CodegenUnit { name, items: Default::default(), size_estimate: None }
|
||||
}
|
||||
|
||||
pub fn name(&self) -> Symbol {
|
||||
|
|
|
@ -532,9 +532,9 @@ impl<'a, 'tcx> Lift<'tcx> for traits::Vtable<'a, ()> {
|
|||
nested,
|
||||
}) => tcx.lift(&substs).map(|substs| {
|
||||
traits::VtableGenerator(traits::VtableGeneratorData {
|
||||
generator_def_id: generator_def_id,
|
||||
substs: substs,
|
||||
nested: nested,
|
||||
generator_def_id,
|
||||
substs,
|
||||
nested,
|
||||
})
|
||||
}),
|
||||
traits::VtableClosure(traits::VtableClosureData { closure_def_id, substs, nested }) => {
|
||||
|
|
|
@ -2256,22 +2256,22 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
|
||||
#[inline]
|
||||
pub fn mk_mut_ref(self, r: Region<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
self.mk_ref(r, TypeAndMut { ty: ty, mutbl: hir::Mutability::Mut })
|
||||
self.mk_ref(r, TypeAndMut { ty, mutbl: hir::Mutability::Mut })
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn mk_imm_ref(self, r: Region<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
self.mk_ref(r, TypeAndMut { ty: ty, mutbl: hir::Mutability::Not })
|
||||
self.mk_ref(r, TypeAndMut { ty, mutbl: hir::Mutability::Not })
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn mk_mut_ptr(self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
self.mk_ptr(TypeAndMut { ty: ty, mutbl: hir::Mutability::Mut })
|
||||
self.mk_ptr(TypeAndMut { ty, mutbl: hir::Mutability::Mut })
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn mk_imm_ptr(self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
self.mk_ptr(TypeAndMut { ty: ty, mutbl: hir::Mutability::Not })
|
||||
self.mk_ptr(TypeAndMut { ty, mutbl: hir::Mutability::Not })
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -2393,7 +2393,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
|
||||
#[inline]
|
||||
pub fn mk_ty_param(self, index: u32, name: Symbol) -> Ty<'tcx> {
|
||||
self.mk_ty(Param(ParamTy { index, name: name }))
|
||||
self.mk_ty(Param(ParamTy { index, name }))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -241,7 +241,7 @@ impl<'tcx> Instance<'tcx> {
|
|||
def_id,
|
||||
substs
|
||||
);
|
||||
Instance { def: InstanceDef::Item(def_id), substs: substs }
|
||||
Instance { def: InstanceDef::Item(def_id), substs }
|
||||
}
|
||||
|
||||
pub fn mono(tcx: TyCtxt<'tcx>, def_id: DefId) -> Instance<'tcx> {
|
||||
|
|
|
@ -370,7 +370,7 @@ pub trait DefIdTree: Copy {
|
|||
|
||||
impl<'tcx> DefIdTree for TyCtxt<'tcx> {
|
||||
fn parent(self, id: DefId) -> Option<DefId> {
|
||||
self.def_key(id).parent.map(|index| DefId { index: index, ..id })
|
||||
self.def_key(id).parent.map(|index| DefId { index, ..id })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2227,7 +2227,7 @@ impl ReprOptions {
|
|||
if !tcx.consider_optimizing(|| format!("Reorder fields of {:?}", tcx.def_path_str(did))) {
|
||||
flags.insert(ReprFlags::IS_LINEAR);
|
||||
}
|
||||
ReprOptions { int: size, align: max_align, pack: min_pack, flags: flags }
|
||||
ReprOptions { int: size, align: max_align, pack: min_pack, flags }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -34,10 +34,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
if !value.has_projections() {
|
||||
value
|
||||
} else {
|
||||
value.fold_with(&mut NormalizeAfterErasingRegionsFolder {
|
||||
tcx: self,
|
||||
param_env: param_env,
|
||||
})
|
||||
value.fold_with(&mut NormalizeAfterErasingRegionsFolder { tcx: self, param_env })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ impl<'tcx> Relate<'tcx> for ty::TraitRef<'tcx> {
|
|||
Err(TypeError::Traits(expected_found(relation, &a.def_id, &b.def_id)))
|
||||
} else {
|
||||
let substs = relate_substs(relation, None, a.substs, b.substs)?;
|
||||
Ok(ty::TraitRef { def_id: a.def_id, substs: substs })
|
||||
Ok(ty::TraitRef { def_id: a.def_id, substs })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ impl<'tcx> Relate<'tcx> for ty::ExistentialTraitRef<'tcx> {
|
|||
Err(TypeError::Traits(expected_found(relation, &a.def_id, &b.def_id)))
|
||||
} else {
|
||||
let substs = relate_substs(relation, None, a.substs, b.substs)?;
|
||||
Ok(ty::ExistentialTraitRef { def_id: a.def_id, substs: substs })
|
||||
Ok(ty::ExistentialTraitRef { def_id: a.def_id, substs })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1193,7 +1193,7 @@ pub struct ParamTy {
|
|||
|
||||
impl<'tcx> ParamTy {
|
||||
pub fn new(index: u32, name: Symbol) -> ParamTy {
|
||||
ParamTy { index, name: name }
|
||||
ParamTy { index, name }
|
||||
}
|
||||
|
||||
pub fn for_self() -> ParamTy {
|
||||
|
|
|
@ -482,7 +482,7 @@ impl<'a> TraitDef<'a> {
|
|||
})
|
||||
.cloned(),
|
||||
);
|
||||
push(Annotatable::Item(P(ast::Item { attrs: attrs, ..(*newitem).clone() })))
|
||||
push(Annotatable::Item(P(ast::Item { attrs, ..(*newitem).clone() })))
|
||||
}
|
||||
_ => {
|
||||
// Non-Item derive is an error, but it should have been
|
||||
|
|
|
@ -148,7 +148,7 @@ impl LlvmType for CastTarget {
|
|||
.prefix
|
||||
.iter()
|
||||
.flat_map(|option_kind| {
|
||||
option_kind.map(|kind| Reg { kind: kind, size: self.prefix_chunk }.llvm_type(cx))
|
||||
option_kind.map(|kind| Reg { kind, size: self.prefix_chunk }.llvm_type(cx))
|
||||
})
|
||||
.chain((0..rest_count).map(|_| rest_ll_unit))
|
||||
.collect();
|
||||
|
|
|
@ -179,7 +179,7 @@ impl<'a, 'tcx> At<'a, 'tcx> {
|
|||
T: ToTrace<'tcx>,
|
||||
{
|
||||
let trace = ToTrace::to_trace(self.cause, a_is_expected, a, b);
|
||||
Trace { at: self, trace: trace, a_is_expected }
|
||||
Trace { at: self, trace, a_is_expected }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ impl<'combine, 'infcx, 'tcx> Equate<'combine, 'infcx, 'tcx> {
|
|||
fields: &'combine mut CombineFields<'infcx, 'tcx>,
|
||||
a_is_expected: bool,
|
||||
) -> Equate<'combine, 'infcx, 'tcx> {
|
||||
Equate { fields: fields, a_is_expected: a_is_expected }
|
||||
Equate { fields, a_is_expected }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,11 +77,11 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
|||
if found_anon_region {
|
||||
let is_first = index == 0;
|
||||
Some(AnonymousParamInfo {
|
||||
param: param,
|
||||
param,
|
||||
param_ty: new_param_ty,
|
||||
param_ty_span: param_ty_span,
|
||||
bound_region: bound_region,
|
||||
is_first: is_first,
|
||||
param_ty_span,
|
||||
bound_region,
|
||||
is_first,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -18,7 +18,7 @@ impl<'combine, 'infcx, 'tcx> Glb<'combine, 'infcx, 'tcx> {
|
|||
fields: &'combine mut CombineFields<'infcx, 'tcx>,
|
||||
a_is_expected: bool,
|
||||
) -> Glb<'combine, 'infcx, 'tcx> {
|
||||
Glb { fields: fields, a_is_expected: a_is_expected }
|
||||
Glb { fields, a_is_expected }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ impl<'combine, 'infcx, 'tcx> Lub<'combine, 'infcx, 'tcx> {
|
|||
fields: &'combine mut CombineFields<'infcx, 'tcx>,
|
||||
a_is_expected: bool,
|
||||
) -> Lub<'combine, 'infcx, 'tcx> {
|
||||
Lub { fields: fields, a_is_expected: a_is_expected }
|
||||
Lub { fields, a_is_expected }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ impl<'tcx> TaintSet<'tcx> {
|
|||
fn new(directions: TaintDirections, initial_region: ty::Region<'tcx>) -> Self {
|
||||
let mut regions = FxHashSet::default();
|
||||
regions.insert(initial_region);
|
||||
TaintSet { directions: directions, regions: regions }
|
||||
TaintSet { directions, regions }
|
||||
}
|
||||
|
||||
fn fixed_point(
|
||||
|
|
|
@ -766,7 +766,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
|
|||
b: Region<'tcx>,
|
||||
origin: SubregionOrigin<'tcx>,
|
||||
) -> Region<'tcx> {
|
||||
let vars = TwoRegions { a: a, b: b };
|
||||
let vars = TwoRegions { a, b };
|
||||
if let Some(&c) = self.combine_map(t).get(&vars) {
|
||||
return tcx.mk_region(ReVar(c));
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ pub fn fully_resolve<'a, 'tcx, T>(infcx: &InferCtxt<'a, 'tcx>, value: &T) -> Fix
|
|||
where
|
||||
T: TypeFoldable<'tcx>,
|
||||
{
|
||||
let mut full_resolver = FullTypeResolver { infcx: infcx, err: None };
|
||||
let mut full_resolver = FullTypeResolver { infcx, err: None };
|
||||
let result = value.fold_with(&mut full_resolver);
|
||||
match full_resolver.err {
|
||||
None => Ok(result),
|
||||
|
|
|
@ -19,7 +19,7 @@ impl<'combine, 'infcx, 'tcx> Sub<'combine, 'infcx, 'tcx> {
|
|||
f: &'combine mut CombineFields<'infcx, 'tcx>,
|
||||
a_is_expected: bool,
|
||||
) -> Sub<'combine, 'infcx, 'tcx> {
|
||||
Sub { fields: f, a_is_expected: a_is_expected }
|
||||
Sub { fields: f, a_is_expected }
|
||||
}
|
||||
|
||||
fn with_expected_switched<R, F: FnOnce(&mut Self) -> R>(&mut self, f: F) -> R {
|
||||
|
|
|
@ -619,7 +619,7 @@ impl<'tcx> FulfillmentError<'tcx> {
|
|||
obligation: PredicateObligation<'tcx>,
|
||||
code: FulfillmentErrorCode<'tcx>,
|
||||
) -> FulfillmentError<'tcx> {
|
||||
FulfillmentError { obligation: obligation, code: code, points_at_arg_span: false }
|
||||
FulfillmentError { obligation, code, points_at_arg_span: false }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -403,7 +403,7 @@ pub type NormalizedTy<'tcx> = Normalized<'tcx, Ty<'tcx>>;
|
|||
|
||||
impl<'tcx, T> Normalized<'tcx, T> {
|
||||
pub fn with<U>(self, value: U) -> Normalized<'tcx, U> {
|
||||
Normalized { value: value, obligations: self.obligations }
|
||||
Normalized { value, obligations: self.obligations }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1291,7 +1291,7 @@ fn confirm_generator_candidate<'cx, 'tcx>(
|
|||
substs: trait_ref.substs,
|
||||
item_def_id: obligation.predicate.item_def_id,
|
||||
},
|
||||
ty: ty,
|
||||
ty,
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -2923,7 +2923,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
ty::Predicate::ClosureKind(closure_def_id, substs, kind),
|
||||
));
|
||||
|
||||
Ok(VtableClosureData { closure_def_id, substs: substs, nested: obligations })
|
||||
Ok(VtableClosureData { closure_def_id, substs, nested: obligations })
|
||||
}
|
||||
|
||||
/// In the case of closure types and fn pointers,
|
||||
|
|
|
@ -55,7 +55,7 @@ struct PredicateSet<'tcx> {
|
|||
|
||||
impl PredicateSet<'tcx> {
|
||||
fn new(tcx: TyCtxt<'tcx>) -> Self {
|
||||
Self { tcx: tcx, set: Default::default() }
|
||||
Self { tcx, set: Default::default() }
|
||||
}
|
||||
|
||||
fn insert(&mut self, pred: &ty::Predicate<'tcx>) -> bool {
|
||||
|
|
|
@ -377,10 +377,10 @@ impl<'s> LintLevelsBuilder<'s> {
|
|||
let prev = self.cur;
|
||||
if !specs.is_empty() {
|
||||
self.cur = self.sets.list.len() as u32;
|
||||
self.sets.list.push(LintSet::Node { specs: specs, parent: prev });
|
||||
self.sets.list.push(LintSet::Node { specs, parent: prev });
|
||||
}
|
||||
|
||||
BuilderPush { prev: prev, changed: prev != self.cur }
|
||||
BuilderPush { prev, changed: prev != self.cur }
|
||||
}
|
||||
|
||||
/// Called after `push` when the scope of a set of attributes are exited.
|
||||
|
|
|
@ -493,7 +493,7 @@ impl<'tcx> EncodeContext<'tcx> {
|
|||
edition: tcx.sess.edition(),
|
||||
has_global_allocator: tcx.has_global_allocator(LOCAL_CRATE),
|
||||
has_panic_handler: tcx.has_panic_handler(LOCAL_CRATE),
|
||||
has_default_lib_allocator: has_default_lib_allocator,
|
||||
has_default_lib_allocator,
|
||||
plugin_registrar_fn: tcx.plugin_registrar_fn(LOCAL_CRATE).map(|id| id.index),
|
||||
proc_macro_decls_static: if is_proc_macro {
|
||||
let id = tcx.proc_macro_decls_static(LOCAL_CRATE).unwrap();
|
||||
|
|
|
@ -175,7 +175,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
if self.body.local_decls[local].is_ref_for_guard() =>
|
||||
{
|
||||
self.append_place_to_string(
|
||||
PlaceRef { local: local, projection: &[] },
|
||||
PlaceRef { local, projection: &[] },
|
||||
buf,
|
||||
autoderef,
|
||||
&including_downcast,
|
||||
|
|
|
@ -140,7 +140,7 @@ impl<N: Idx> LivenessValues<N> {
|
|||
/// Each of the regions in num_region_variables will be initialized with an
|
||||
/// empty set of points and no causal information.
|
||||
crate fn new(elements: Rc<RegionValueElements>) -> Self {
|
||||
Self { points: SparseBitMatrix::new(elements.num_points), elements: elements }
|
||||
Self { points: SparseBitMatrix::new(elements.num_points), elements }
|
||||
}
|
||||
|
||||
/// Iterate through each region that has a value in this set.
|
||||
|
|
|
@ -486,7 +486,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
|||
defining_ty,
|
||||
unnormalized_output_ty,
|
||||
unnormalized_input_tys,
|
||||
yield_ty: yield_ty,
|
||||
yield_ty,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ pub struct Edge {
|
|||
|
||||
fn outgoing(body: &Body<'_>, bb: BasicBlock) -> Vec<Edge> {
|
||||
(0..body[bb].terminator().successors().count())
|
||||
.map(|index| Edge { source: bb, index: index })
|
||||
.map(|index| Edge { source: bb, index })
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
|
|
@ -474,7 +474,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
|
|||
}
|
||||
|
||||
fn record_move(&mut self, place: &Place<'tcx>, path: MovePathIndex) {
|
||||
let move_out = self.builder.data.moves.push(MoveOut { path: path, source: self.loc });
|
||||
let move_out = self.builder.data.moves.push(MoveOut { path, source: self.loc });
|
||||
debug!(
|
||||
"gather_move({:?}, {:?}): adding move {:?} of {:?}",
|
||||
self.loc, place, move_out, path
|
||||
|
|
|
@ -647,7 +647,7 @@ where
|
|||
}
|
||||
local => PlaceTy {
|
||||
// This works even for dead/uninitialized locals; we check further when writing
|
||||
place: Place::Local { frame: self.cur_frame(), local: local },
|
||||
place: Place::Local { frame: self.cur_frame(), local },
|
||||
layout: self.layout_of_local(self.frame(), local, None)?,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -13,7 +13,7 @@ pub fn custom_coerce_unsize_info<'tcx>(
|
|||
let def_id = tcx.lang_items().coerce_unsized_trait().unwrap();
|
||||
|
||||
let trait_ref = ty::Binder::bind(ty::TraitRef {
|
||||
def_id: def_id,
|
||||
def_id,
|
||||
substs: tcx.mk_substs_trait(source_ty, &[target_ty.into()]),
|
||||
});
|
||||
|
||||
|
|
|
@ -75,8 +75,8 @@ impl<'tcx> MirPass<'tcx> for AddRetag {
|
|||
{
|
||||
let source_info = SourceInfo {
|
||||
scope: OUTERMOST_SOURCE_SCOPE,
|
||||
span: span, // FIXME: Consider using just the span covering the function
|
||||
// argument declaration.
|
||||
span, // FIXME: Consider using just the span covering the function
|
||||
// argument declaration.
|
||||
};
|
||||
// Gather all arguments, skip return value.
|
||||
let places = local_decls
|
||||
|
|
|
@ -506,7 +506,7 @@ fn locals_live_across_suspend_points(
|
|||
|
||||
for (block, data) in body.basic_blocks().iter_enumerated() {
|
||||
if let TerminatorKind::Yield { .. } = data.terminator().kind {
|
||||
let loc = Location { block: block, statement_index: data.statements.len() };
|
||||
let loc = Location { block, statement_index: data.statements.len() };
|
||||
|
||||
if !movable {
|
||||
// The `liveness` variable contains the liveness of MIR locals ignoring borrows.
|
||||
|
|
|
@ -34,7 +34,7 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
|
|||
let attributes = tcx.get_attrs(def_id);
|
||||
let param_env = tcx.param_env(def_id);
|
||||
let move_data = MoveData::gather_moves(body, tcx, param_env).unwrap();
|
||||
let mdpe = MoveDataParamEnv { move_data: move_data, param_env: param_env };
|
||||
let mdpe = MoveDataParamEnv { move_data, param_env };
|
||||
|
||||
let flow_inits = MaybeInitializedPlaces::new(tcx, body, &mdpe)
|
||||
.into_engine(tcx, body, def_id)
|
||||
|
|
|
@ -872,7 +872,7 @@ where
|
|||
debug!("drop_flag_reset_block({:?},{:?})", self, mode);
|
||||
|
||||
let block = self.new_block(unwind, TerminatorKind::Goto { target: succ });
|
||||
let block_start = Location { block: block, statement_index: 0 };
|
||||
let block_start = Location { block, statement_index: 0 };
|
||||
self.elaborator.clear_drop_flag(block_start, self.path, mode);
|
||||
block
|
||||
}
|
||||
|
@ -921,7 +921,7 @@ where
|
|||
|
||||
let call = TerminatorKind::Call {
|
||||
func: Operand::function_handle(tcx, free_func, substs, self.source_info.span),
|
||||
args: args,
|
||||
args,
|
||||
destination: Some((unit_temp, target)),
|
||||
cleanup: None,
|
||||
from_hir_call: false,
|
||||
|
|
|
@ -297,7 +297,7 @@ where
|
|||
writeln!(w, "{}{:?}{}: {{", INDENT, block, cleanup_text)?;
|
||||
|
||||
// List of statements in the middle.
|
||||
let mut current_location = Location { block: block, statement_index: 0 };
|
||||
let mut current_location = Location { block, statement_index: 0 };
|
||||
for statement in &data.statements {
|
||||
extra_data(PassWhere::BeforeLocation(current_location), w)?;
|
||||
let indented_body = format!("{0}{0}{1:?};", INDENT, statement);
|
||||
|
|
|
@ -113,7 +113,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
// value being matched, taking the variance field into account.
|
||||
candidate.ascriptions.push(Ascription {
|
||||
span: user_ty_span,
|
||||
user_ty: user_ty,
|
||||
user_ty,
|
||||
source: match_pair.place,
|
||||
variance,
|
||||
});
|
||||
|
|
|
@ -64,10 +64,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
PatKind::Slice { ref prefix, ref slice, ref suffix } => {
|
||||
let len = prefix.len() + suffix.len();
|
||||
let op = if slice.is_some() { BinOp::Ge } else { BinOp::Eq };
|
||||
Test {
|
||||
span: match_pair.pattern.span,
|
||||
kind: TestKind::Len { len: len as u64, op: op },
|
||||
}
|
||||
Test { span: match_pair.pattern.span, kind: TestKind::Len { len: len as u64, op } }
|
||||
}
|
||||
|
||||
PatKind::Or { .. } => bug!("or-patterns should have already been handled"),
|
||||
|
|
|
@ -418,7 +418,7 @@ struct GuardFrameLocal {
|
|||
|
||||
impl GuardFrameLocal {
|
||||
fn new(id: hir::HirId, _binding_mode: BindingMode) -> Self {
|
||||
GuardFrameLocal { id: id }
|
||||
GuardFrameLocal { id }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ fn mirror_stmts<'a, 'tcx>(
|
|||
|
||||
result.push(StmtRef::Mirror(Box::new(Stmt {
|
||||
kind: StmtKind::Let {
|
||||
remainder_scope: remainder_scope,
|
||||
remainder_scope,
|
||||
init_scope: region::Scope {
|
||||
id: hir_id.local_id,
|
||||
data: region::ScopeData::Node,
|
||||
|
|
|
@ -2102,7 +2102,7 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
|||
.is_ok()
|
||||
{
|
||||
let def_id = module.def_id().unwrap();
|
||||
found_traits.push(TraitCandidate { def_id: def_id, import_ids: smallvec![] });
|
||||
found_traits.push(TraitCandidate { def_id, import_ids: smallvec![] });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1032,13 +1032,13 @@ struct Shadower {
|
|||
}
|
||||
|
||||
fn original_label(span: Span) -> Original {
|
||||
Original { kind: ShadowKind::Label, span: span }
|
||||
Original { kind: ShadowKind::Label, span }
|
||||
}
|
||||
fn shadower_label(span: Span) -> Shadower {
|
||||
Shadower { kind: ShadowKind::Label, span: span }
|
||||
Shadower { kind: ShadowKind::Label, span }
|
||||
}
|
||||
fn original_lifetime(span: Span) -> Original {
|
||||
Original { kind: ShadowKind::Lifetime, span: span }
|
||||
Original { kind: ShadowKind::Lifetime, span }
|
||||
}
|
||||
fn shadower_lifetime(param: &hir::GenericParam<'_>) -> Shadower {
|
||||
Shadower { kind: ShadowKind::Lifetime, span: param.span }
|
||||
|
@ -1347,7 +1347,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
|||
let missing_named_lifetime_spots = take(&mut self.missing_named_lifetime_spots);
|
||||
let mut this = LifetimeContext {
|
||||
tcx: *tcx,
|
||||
map: map,
|
||||
map,
|
||||
scope: &wrap_scope,
|
||||
trait_ref_hack: self.trait_ref_hack,
|
||||
is_in_fn_syntax: self.is_in_fn_syntax,
|
||||
|
|
|
@ -334,7 +334,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
|
|||
Some(_) => ImplKind::Direct,
|
||||
None => ImplKind::Inherent,
|
||||
},
|
||||
span: span,
|
||||
span,
|
||||
value: String::new(),
|
||||
parent: None,
|
||||
children: items
|
||||
|
|
|
@ -793,7 +793,7 @@ impl Sig for ast::ForeignItem {
|
|||
text.push_str(&name);
|
||||
text.push(';');
|
||||
|
||||
Ok(Signature { text: text, defs: defs, refs: vec![] })
|
||||
Ok(Signature { text, defs, refs: vec![] })
|
||||
}
|
||||
ast::ForeignItemKind::Macro(..) => Err("macro"),
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ impl CodeStats {
|
|||
type_description: type_desc.to_string(),
|
||||
align: align.bytes(),
|
||||
overall_size: overall_size.bytes(),
|
||||
packed: packed,
|
||||
packed,
|
||||
opt_discr_size: opt_discr_size.map(|s| s.bytes()),
|
||||
variants,
|
||||
};
|
||||
|
|
|
@ -130,7 +130,7 @@ impl DefId {
|
|||
/// Makes a local `DefId` from the given `DefIndex`.
|
||||
#[inline]
|
||||
pub fn local(index: DefIndex) -> DefId {
|
||||
DefId { krate: LOCAL_CRATE, index: index }
|
||||
DefId { krate: LOCAL_CRATE, index }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -47,7 +47,7 @@ pub fn resolve_instance<'tcx>(
|
|||
}
|
||||
}
|
||||
};
|
||||
Some(Instance { def: def, substs: substs })
|
||||
Some(Instance { def, substs })
|
||||
};
|
||||
debug!("resolve(def_id={:?}, substs={:?}) = {:?}", def_id, substs, result);
|
||||
result
|
||||
|
|
|
@ -404,7 +404,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
let needs = Needs::maybe_mut_place(mutbl);
|
||||
let ty = self.check_expr_with_expectation_and_needs(&oprnd, hint, needs);
|
||||
|
||||
let tm = ty::TypeAndMut { ty: ty, mutbl: mutbl };
|
||||
let tm = ty::TypeAndMut { ty, mutbl };
|
||||
match kind {
|
||||
_ if tm.ty.references_error() => self.tcx.types.err,
|
||||
hir::BorrowKind::Raw => {
|
||||
|
|
|
@ -4234,7 +4234,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
let substs = self.fresh_substs_for_item(span, did);
|
||||
let substd_ty = self.instantiate_type_scheme(span, &substs, &ity);
|
||||
|
||||
TypeAndSubsts { substs: substs, ty: substd_ty }
|
||||
TypeAndSubsts { substs, ty: substd_ty }
|
||||
}
|
||||
|
||||
/// Unifies the output type with the expected type early, for more coercions
|
||||
|
|
|
@ -31,10 +31,10 @@ pub fn infer_predicates<'tcx>(
|
|||
predicates_added = false;
|
||||
|
||||
let mut visitor = InferVisitor {
|
||||
tcx: tcx,
|
||||
tcx,
|
||||
global_inferred_outlives: &mut global_inferred_outlives,
|
||||
predicates_added: &mut predicates_added,
|
||||
explicit_map: explicit_map,
|
||||
explicit_map,
|
||||
};
|
||||
|
||||
// Visit all the crates and infer predicates
|
||||
|
|
|
@ -44,7 +44,7 @@ impl Module<'hir> {
|
|||
vis: &'hir hir::Visibility<'hir>,
|
||||
) -> Module<'hir> {
|
||||
Module {
|
||||
name: name,
|
||||
name,
|
||||
id: hir::CRATE_HIR_ID,
|
||||
vis,
|
||||
where_outer: rustc_span::DUMMY_SP,
|
||||
|
|
|
@ -2461,7 +2461,7 @@ impl RandomState {
|
|||
KEYS.with(|keys| {
|
||||
let (k0, k1) = keys.get();
|
||||
keys.set((k0.wrapping_add(1), k1));
|
||||
RandomState { k0: k0, k1: k1 }
|
||||
RandomState { k0, k1 }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ impl<T> Cursor<T> {
|
|||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn new(inner: T) -> Cursor<T> {
|
||||
Cursor { pos: 0, inner: inner }
|
||||
Cursor { pos: 0, inner }
|
||||
}
|
||||
|
||||
/// Consumes this cursor, returning the underlying value.
|
||||
|
|
|
@ -371,7 +371,7 @@ where
|
|||
F: FnMut(&R) -> usize,
|
||||
{
|
||||
let start_len = buf.len();
|
||||
let mut g = Guard { len: buf.len(), buf: buf };
|
||||
let mut g = Guard { len: buf.len(), buf };
|
||||
let ret;
|
||||
loop {
|
||||
if g.len == g.buf.len() {
|
||||
|
@ -939,7 +939,7 @@ pub trait Read {
|
|||
where
|
||||
Self: Sized,
|
||||
{
|
||||
Take { inner: self, limit: limit }
|
||||
Take { inner: self, limit }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -416,7 +416,7 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for Mutex<T> {
|
|||
|
||||
impl<'mutex, T: ?Sized> MutexGuard<'mutex, T> {
|
||||
unsafe fn new(lock: &'mutex Mutex<T>) -> LockResult<MutexGuard<'mutex, T>> {
|
||||
poison::map_result(lock.poison.borrow(), |guard| MutexGuard { lock: lock, poison: guard })
|
||||
poison::map_result(lock.poison.borrow(), |guard| MutexGuard { lock, poison: guard })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -465,16 +465,13 @@ impl<T> From<T> for RwLock<T> {
|
|||
|
||||
impl<'rwlock, T: ?Sized> RwLockReadGuard<'rwlock, T> {
|
||||
unsafe fn new(lock: &'rwlock RwLock<T>) -> LockResult<RwLockReadGuard<'rwlock, T>> {
|
||||
poison::map_result(lock.poison.borrow(), |_| RwLockReadGuard { lock: lock })
|
||||
poison::map_result(lock.poison.borrow(), |_| RwLockReadGuard { lock })
|
||||
}
|
||||
}
|
||||
|
||||
impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T> {
|
||||
unsafe fn new(lock: &'rwlock RwLock<T>) -> LockResult<RwLockWriteGuard<'rwlock, T>> {
|
||||
poison::map_result(lock.poison.borrow(), |guard| RwLockWriteGuard {
|
||||
lock: lock,
|
||||
poison: guard,
|
||||
})
|
||||
poison::map_result(lock.poison.borrow(), |guard| RwLockWriteGuard { lock, poison: guard })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue