Skip to content

Commit 9d9146a

Browse files
committed
Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwco
refactor: use shorthand fields refactor: use shorthand for single fields everywhere (excluding tests).
2 parents e222d1d + eca11b9 commit 9d9146a

File tree

57 files changed

+68
-68
lines changed

Some content is hidden

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

57 files changed

+68
-68
lines changed

src/liballoc/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ impl String {
502502
#[stable(feature = "rust1", since = "1.0.0")]
503503
pub fn from_utf8(vec: Vec<u8>) -> Result<String, FromUtf8Error> {
504504
match str::from_utf8(&vec) {
505-
Ok(..) => Ok(String { vec: vec }),
505+
Ok(..) => Ok(String { vec }),
506506
Err(e) => {
507507
Err(FromUtf8Error {
508508
bytes: vec,

src/libpanic_unwind/dwarf/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct Unaligned<T>(T);
2929

3030
impl DwarfReader {
3131
pub fn new(ptr: *const u8) -> DwarfReader {
32-
DwarfReader { ptr: ptr }
32+
DwarfReader { ptr }
3333
}
3434

3535
// DWARF streams are packed, so e.g. a u32 would not necessarily be aligned

src/libpanic_unwind/seh64_gnu.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct PanicData {
4141
}
4242

4343
pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
44-
let panic_ctx = Box::new(PanicData { data: data });
44+
let panic_ctx = Box::new(PanicData { data });
4545
let params = [Box::into_raw(panic_ctx) as c::ULONG_PTR];
4646
c::RaiseException(RUST_PANIC,
4747
c::EXCEPTION_NONCONTINUABLE,

src/librustc/infer/resolve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct OpportunisticTypeResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
2626

2727
impl<'a, 'gcx, 'tcx> OpportunisticTypeResolver<'a, 'gcx, 'tcx> {
2828
pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self {
29-
OpportunisticTypeResolver { infcx: infcx }
29+
OpportunisticTypeResolver { infcx }
3030
}
3131
}
3232

@@ -54,7 +54,7 @@ pub struct OpportunisticTypeAndRegionResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
5454

5555
impl<'a, 'gcx, 'tcx> OpportunisticTypeAndRegionResolver<'a, 'gcx, 'tcx> {
5656
pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self {
57-
OpportunisticTypeAndRegionResolver { infcx: infcx }
57+
OpportunisticTypeAndRegionResolver { infcx }
5858
}
5959
}
6060

src/librustc/infer/type_variable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
169169
// Hack: we only need this so that `types_escaping_snapshot`
170170
// can see what has been unified; see the Delegate impl for
171171
// more details.
172-
self.values.record(Instantiate { vid: vid });
172+
self.values.record(Instantiate { vid });
173173
}
174174

175175
/// Creates a new type variable.

src/librustc/infer/unify_key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl UnifyValue for RegionVidKey {
4343
value2.min_vid
4444
};
4545

46-
Ok(RegionVidKey { min_vid: min_vid })
46+
Ok(RegionVidKey { min_vid })
4747
}
4848
}
4949

src/librustc/middle/stability.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ impl<'a, 'tcx> Index<'tcx> {
469469
/// Cross-references the feature names of unstable APIs with enabled
470470
/// features and possibly prints errors.
471471
pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
472-
let mut checker = Checker { tcx: tcx };
472+
let mut checker = Checker { tcx };
473473
tcx.hir.krate().visit_all_item_likes(&mut checker.as_deep_visitor());
474474
}
475475

src/librustc/mir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2986,7 +2986,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
29862986
use mir::TerminatorKind::*;
29872987

29882988
let kind = match self.kind {
2989-
Goto { target } => Goto { target: target },
2989+
Goto { target } => Goto { target },
29902990
SwitchInt {
29912991
ref discr,
29922992
switch_ty,

src/librustc/mir/tcx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub enum PlaceTy<'tcx> {
3232

3333
impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> {
3434
pub fn from_ty(ty: Ty<'tcx>) -> PlaceTy<'tcx> {
35-
PlaceTy::Ty { ty: ty }
35+
PlaceTy::Ty { ty }
3636
}
3737

3838
pub fn to_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> {

src/librustc/traits/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ fn project_and_unify_type<'cx, 'gcx, 'tcx>(
266266
},
267267
Err(err) => {
268268
debug!("project_and_unify_type: equating types encountered error {:?}", err);
269-
Err(MismatchedProjectionTypes { err: err })
269+
Err(MismatchedProjectionTypes { err })
270270
}
271271
}
272272
}

0 commit comments

Comments
 (0)