Skip to content

Commit 83980ac

Browse files
committed
Don't redundantly repeat field names (clippy::redundant_field_names)
1 parent 865b44a commit 83980ac

File tree

61 files changed

+88
-100
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+88
-100
lines changed

src/liballoc/collections/linked_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ impl<T> LinkedList<T> {
959959
let it = self.head;
960960
let old_len = self.len;
961961

962-
DrainFilter { list: self, it: it, pred: filter, idx: 0, old_len: old_len }
962+
DrainFilter { list: self, it, pred: filter, idx: 0, old_len }
963963
}
964964
}
965965

src/liballoc/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1659,7 +1659,7 @@ struct SetLenOnDrop<'a> {
16591659
impl<'a> SetLenOnDrop<'a> {
16601660
#[inline]
16611661
fn new(len: &'a mut usize) -> Self {
1662-
SetLenOnDrop { local_len: *len, len: len }
1662+
SetLenOnDrop { local_len: *len, len }
16631663
}
16641664

16651665
#[inline]

src/libproc_macro/diagnostic.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ pub struct Diagnostic {
5555
}
5656

5757
macro_rules! diagnostic_child_methods {
58-
($spanned:ident, $regular:ident, $level:expr) => (
58+
($spanned:ident, $regular:ident, $level:expr) => {
5959
/// Adds a new child diagnostic message to `self` with the level
6060
/// identified by this method's name with the given `spans` and
6161
/// `message`.
6262
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
6363
pub fn $spanned<S, T>(mut self, spans: S, message: T) -> Diagnostic
64-
where S: MultiSpan, T: Into<String>
64+
where
65+
S: MultiSpan,
66+
T: Into<String>,
6567
{
6668
self.children.push(Diagnostic::spanned(spans, $level, message));
6769
self
@@ -74,7 +76,7 @@ macro_rules! diagnostic_child_methods {
7476
self.children.push(Diagnostic::new($level, message));
7577
self
7678
}
77-
)
79+
};
7880
}
7981

8082
/// Iterator over the children diagnostics of a `Diagnostic`.
@@ -96,7 +98,7 @@ impl Diagnostic {
9698
/// Creates a new diagnostic with the given `level` and `message`.
9799
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
98100
pub fn new<T: Into<String>>(level: Level, message: T) -> Diagnostic {
99-
Diagnostic { level: level, message: message.into(), spans: vec![], children: vec![] }
101+
Diagnostic { level, message: message.into(), spans: vec![], children: vec![] }
100102
}
101103

102104
/// Creates a new diagnostic with the given `level` and `message` pointing to
@@ -107,12 +109,7 @@ impl Diagnostic {
107109
S: MultiSpan,
108110
T: Into<String>,
109111
{
110-
Diagnostic {
111-
level: level,
112-
message: message.into(),
113-
spans: spans.into_spans(),
114-
children: vec![],
115-
}
112+
Diagnostic { level, message: message.into(), spans: spans.into_spans(), children: vec![] }
116113
}
117114

118115
diagnostic_child_methods!(span_error, error, Level::Error);

src/librustc/hir/map/definitions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ impl DefPath {
192192
}
193193
}
194194
data.reverse();
195-
DefPath { data: data, krate: krate }
195+
DefPath { data, krate }
196196
}
197197

198198
/// Returns a string representation of the `DefPath` without

src/librustc/mir/mono.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ pub enum Visibility {
258258

259259
impl<'tcx> CodegenUnit<'tcx> {
260260
pub fn new(name: Symbol) -> CodegenUnit<'tcx> {
261-
CodegenUnit { name: name, items: Default::default(), size_estimate: None }
261+
CodegenUnit { name, items: Default::default(), size_estimate: None }
262262
}
263263

264264
pub fn name(&self) -> Symbol {

src/librustc/traits/structural_impls.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,9 @@ impl<'a, 'tcx> Lift<'tcx> for traits::Vtable<'a, ()> {
532532
nested,
533533
}) => tcx.lift(&substs).map(|substs| {
534534
traits::VtableGenerator(traits::VtableGeneratorData {
535-
generator_def_id: generator_def_id,
536-
substs: substs,
537-
nested: nested,
535+
generator_def_id,
536+
substs,
537+
nested,
538538
})
539539
}),
540540
traits::VtableClosure(traits::VtableClosureData { closure_def_id, substs, nested }) => {

src/librustc/ty/context.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,22 +2256,22 @@ impl<'tcx> TyCtxt<'tcx> {
22562256

22572257
#[inline]
22582258
pub fn mk_mut_ref(self, r: Region<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
2259-
self.mk_ref(r, TypeAndMut { ty: ty, mutbl: hir::Mutability::Mut })
2259+
self.mk_ref(r, TypeAndMut { ty, mutbl: hir::Mutability::Mut })
22602260
}
22612261

22622262
#[inline]
22632263
pub fn mk_imm_ref(self, r: Region<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
2264-
self.mk_ref(r, TypeAndMut { ty: ty, mutbl: hir::Mutability::Not })
2264+
self.mk_ref(r, TypeAndMut { ty, mutbl: hir::Mutability::Not })
22652265
}
22662266

22672267
#[inline]
22682268
pub fn mk_mut_ptr(self, ty: Ty<'tcx>) -> Ty<'tcx> {
2269-
self.mk_ptr(TypeAndMut { ty: ty, mutbl: hir::Mutability::Mut })
2269+
self.mk_ptr(TypeAndMut { ty, mutbl: hir::Mutability::Mut })
22702270
}
22712271

22722272
#[inline]
22732273
pub fn mk_imm_ptr(self, ty: Ty<'tcx>) -> Ty<'tcx> {
2274-
self.mk_ptr(TypeAndMut { ty: ty, mutbl: hir::Mutability::Not })
2274+
self.mk_ptr(TypeAndMut { ty, mutbl: hir::Mutability::Not })
22752275
}
22762276

22772277
#[inline]
@@ -2393,7 +2393,7 @@ impl<'tcx> TyCtxt<'tcx> {
23932393

23942394
#[inline]
23952395
pub fn mk_ty_param(self, index: u32, name: Symbol) -> Ty<'tcx> {
2396-
self.mk_ty(Param(ParamTy { index, name: name }))
2396+
self.mk_ty(Param(ParamTy { index, name }))
23972397
}
23982398

23992399
#[inline]

src/librustc/ty/instance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl<'tcx> Instance<'tcx> {
241241
def_id,
242242
substs
243243
);
244-
Instance { def: InstanceDef::Item(def_id), substs: substs }
244+
Instance { def: InstanceDef::Item(def_id), substs }
245245
}
246246

247247
pub fn mono(tcx: TyCtxt<'tcx>, def_id: DefId) -> Instance<'tcx> {

src/librustc/ty/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ pub trait DefIdTree: Copy {
370370

371371
impl<'tcx> DefIdTree for TyCtxt<'tcx> {
372372
fn parent(self, id: DefId) -> Option<DefId> {
373-
self.def_key(id).parent.map(|index| DefId { index: index, ..id })
373+
self.def_key(id).parent.map(|index| DefId { index, ..id })
374374
}
375375
}
376376

@@ -2227,7 +2227,7 @@ impl ReprOptions {
22272227
if !tcx.consider_optimizing(|| format!("Reorder fields of {:?}", tcx.def_path_str(did))) {
22282228
flags.insert(ReprFlags::IS_LINEAR);
22292229
}
2230-
ReprOptions { int: size, align: max_align, pack: min_pack, flags: flags }
2230+
ReprOptions { int: size, align: max_align, pack: min_pack, flags }
22312231
}
22322232

22332233
#[inline]

src/librustc/ty/normalize_erasing_regions.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ impl<'tcx> TyCtxt<'tcx> {
3434
if !value.has_projections() {
3535
value
3636
} else {
37-
value.fold_with(&mut NormalizeAfterErasingRegionsFolder {
38-
tcx: self,
39-
param_env: param_env,
40-
})
37+
value.fold_with(&mut NormalizeAfterErasingRegionsFolder { tcx: self, param_env })
4138
}
4239
}
4340

0 commit comments

Comments
 (0)