Skip to content

Commit 1831867

Browse files
author
bors-servo
authored
Auto merge of #1095 - emilio:nits, r=pepyakin
ir: Cleanup a bunch of constructors Should be no change in behavior.
2 parents 7fbedf5 + 3c4ccd2 commit 1831867

File tree

9 files changed

+41
-44
lines changed

9 files changed

+41
-44
lines changed

src/ir/comp.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ impl Method {
6262
/// Construct a new `Method`.
6363
pub fn new(kind: MethodKind, signature: FunctionId, is_const: bool) -> Self {
6464
Method {
65-
kind: kind,
66-
signature: signature,
67-
is_const: is_const,
65+
kind,
66+
signature,
67+
is_const,
6868
}
6969
}
7070

@@ -311,7 +311,7 @@ impl Bitfield {
311311
assert!(raw.bitfield_width().is_some());
312312

313313
Bitfield {
314-
offset_into_unit: offset_into_unit,
314+
offset_into_unit,
315315
data: raw.0,
316316
getter_name: None,
317317
setter_name: None,
@@ -420,13 +420,13 @@ impl RawField {
420420
offset: Option<usize>,
421421
) -> RawField {
422422
RawField(FieldData {
423-
name: name,
424-
ty: ty,
425-
comment: comment,
423+
name,
424+
ty,
425+
comment,
426426
annotations: annotations.unwrap_or_default(),
427-
bitfield_width: bitfield_width,
428-
mutable: mutable,
429-
offset: offset,
427+
bitfield_width,
428+
mutable,
429+
offset,
430430
})
431431
}
432432
}

src/ir/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ impl<'ctx> WhitelistedItemsTraversal<'ctx> {
491491
R: IntoIterator<Item = ItemId>,
492492
{
493493
WhitelistedItemsTraversal {
494-
ctx: ctx,
494+
ctx,
495495
traversal: ItemTraversal::new(ctx, roots, predicate),
496496
}
497497
}

src/ir/enum_ty.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ impl Enum {
3737
/// Construct a new `Enum` with the given representation and variants.
3838
pub fn new(repr: Option<TypeId>, variants: Vec<EnumVariant>) -> Self {
3939
Enum {
40-
repr: repr,
41-
variants: variants,
40+
repr,
41+
variants,
4242
}
4343
}
4444

@@ -204,10 +204,10 @@ impl EnumVariant {
204204
custom_behavior: Option<EnumVariantCustomBehavior>,
205205
) -> Self {
206206
EnumVariant {
207-
name: name,
208-
comment: comment,
209-
val: val,
210-
custom_behavior: custom_behavior,
207+
name,
208+
comment,
209+
val,
210+
custom_behavior,
211211
}
212212
}
213213

src/ir/function.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,18 @@ impl Function {
8888
pub fn new(
8989
name: String,
9090
mangled_name: Option<String>,
91-
sig: TypeId,
91+
signature: TypeId,
9292
comment: Option<String>,
9393
kind: FunctionKind,
9494
linkage: Linkage
9595
) -> Self {
9696
Function {
97-
name: name,
98-
mangled_name: mangled_name,
99-
signature: sig,
100-
comment: comment,
101-
kind: kind,
102-
linkage: linkage
97+
name,
98+
mangled_name,
99+
signature,
100+
comment,
101+
kind,
102+
linkage,
103103
}
104104
}
105105

src/ir/layout.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ impl Layout {
3333
/// packed.
3434
pub fn new(size: usize, align: usize) -> Self {
3535
Layout {
36-
size: size,
37-
align: align,
36+
size,
37+
align,
3838
packed: false,
3939
}
4040
}

src/ir/template.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -214,16 +214,13 @@ pub struct TemplateInstantiation {
214214

215215
impl TemplateInstantiation {
216216
/// Construct a new template instantiation from the given parts.
217-
pub fn new<I>(
218-
template_definition: TypeId,
219-
template_args: I,
220-
) -> TemplateInstantiation
217+
pub fn new<I>(definition: TypeId, args: I) -> TemplateInstantiation
221218
where
222219
I: IntoIterator<Item = TypeId>,
223220
{
224221
TemplateInstantiation {
225-
definition: template_definition,
226-
args: template_args.into_iter().collect(),
222+
definition,
223+
args: args.into_iter().collect(),
227224
}
228225
}
229226

src/ir/traversal.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ impl Edge {
2121
/// Construct a new edge whose referent is `to` and is of the given `kind`.
2222
pub fn new(to: ItemId, kind: EdgeKind) -> Edge {
2323
Edge {
24-
to: to,
25-
kind: kind,
24+
to,
25+
kind,
2626
}
2727
}
2828
}

src/ir/ty.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ impl Type {
6969
is_const: bool,
7070
) -> Self {
7171
Type {
72-
name: name,
73-
layout: layout,
74-
kind: kind,
75-
is_const: is_const,
72+
name,
73+
layout,
74+
kind,
75+
is_const,
7676
}
7777
}
7878

src/ir/var.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@ impl Var {
4646
/// Construct a new `Var`.
4747
pub fn new(
4848
name: String,
49-
mangled: Option<String>,
49+
mangled_name: Option<String>,
5050
ty: TypeId,
5151
val: Option<VarType>,
5252
is_const: bool,
5353
) -> Var {
5454
assert!(!name.is_empty());
5555
Var {
56-
name: name,
57-
mangled_name: mangled,
58-
ty: ty,
59-
val: val,
60-
is_const: is_const,
56+
name,
57+
mangled_name,
58+
ty,
59+
val,
60+
is_const,
6161
}
6262
}
6363

0 commit comments

Comments
 (0)