diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-10-24 09:06:00 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-10-24 09:06:00 +0200 |
commit | 3c4ccd2d5ae8fed1f901bcda560b07e9e431ed91 (patch) | |
tree | 4149df06ef8f5cd09edfa7105a046235ff105031 | |
parent | 02dc2bff695ce6c3068ec4f53bb37f92b5873a84 (diff) |
ir: Cleanup a bunch of constructors
To use the shorthand initialization syntax.
-rw-r--r-- | src/ir/comp.rs | 20 | ||||
-rw-r--r-- | src/ir/context.rs | 2 | ||||
-rw-r--r-- | src/ir/enum_ty.rs | 12 | ||||
-rw-r--r-- | src/ir/function.rs | 14 | ||||
-rw-r--r-- | src/ir/layout.rs | 4 | ||||
-rw-r--r-- | src/ir/template.rs | 9 | ||||
-rw-r--r-- | src/ir/traversal.rs | 4 | ||||
-rw-r--r-- | src/ir/ty.rs | 8 | ||||
-rw-r--r-- | src/ir/var.rs | 12 |
9 files changed, 41 insertions, 44 deletions
diff --git a/src/ir/comp.rs b/src/ir/comp.rs index c77834ee..46f895da 100644 --- a/src/ir/comp.rs +++ b/src/ir/comp.rs @@ -62,9 +62,9 @@ impl Method { /// Construct a new `Method`. pub fn new(kind: MethodKind, signature: FunctionId, is_const: bool) -> Self { Method { - kind: kind, - signature: signature, - is_const: is_const, + kind, + signature, + is_const, } } @@ -311,7 +311,7 @@ impl Bitfield { assert!(raw.bitfield_width().is_some()); Bitfield { - offset_into_unit: offset_into_unit, + offset_into_unit, data: raw.0, getter_name: None, setter_name: None, @@ -420,13 +420,13 @@ impl RawField { offset: Option<usize>, ) -> RawField { RawField(FieldData { - name: name, - ty: ty, - comment: comment, + name, + ty, + comment, annotations: annotations.unwrap_or_default(), - bitfield_width: bitfield_width, - mutable: mutable, - offset: offset, + bitfield_width, + mutable, + offset, }) } } diff --git a/src/ir/context.rs b/src/ir/context.rs index 560f6ec2..a108fa10 100644 --- a/src/ir/context.rs +++ b/src/ir/context.rs @@ -491,7 +491,7 @@ impl<'ctx> WhitelistedItemsTraversal<'ctx> { R: IntoIterator<Item = ItemId>, { WhitelistedItemsTraversal { - ctx: ctx, + ctx, traversal: ItemTraversal::new(ctx, roots, predicate), } } diff --git a/src/ir/enum_ty.rs b/src/ir/enum_ty.rs index 3006ec7f..d0968515 100644 --- a/src/ir/enum_ty.rs +++ b/src/ir/enum_ty.rs @@ -37,8 +37,8 @@ impl Enum { /// Construct a new `Enum` with the given representation and variants. pub fn new(repr: Option<TypeId>, variants: Vec<EnumVariant>) -> Self { Enum { - repr: repr, - variants: variants, + repr, + variants, } } @@ -204,10 +204,10 @@ impl EnumVariant { custom_behavior: Option<EnumVariantCustomBehavior>, ) -> Self { EnumVariant { - name: name, - comment: comment, - val: val, - custom_behavior: custom_behavior, + name, + comment, + val, + custom_behavior, } } diff --git a/src/ir/function.rs b/src/ir/function.rs index d5976744..60a7effd 100644 --- a/src/ir/function.rs +++ b/src/ir/function.rs @@ -88,18 +88,18 @@ impl Function { pub fn new( name: String, mangled_name: Option<String>, - sig: TypeId, + signature: TypeId, comment: Option<String>, kind: FunctionKind, linkage: Linkage ) -> Self { Function { - name: name, - mangled_name: mangled_name, - signature: sig, - comment: comment, - kind: kind, - linkage: linkage + name, + mangled_name, + signature, + comment, + kind, + linkage, } } diff --git a/src/ir/layout.rs b/src/ir/layout.rs index 0d9c123f..ac875ca4 100644 --- a/src/ir/layout.rs +++ b/src/ir/layout.rs @@ -33,8 +33,8 @@ impl Layout { /// packed. pub fn new(size: usize, align: usize) -> Self { Layout { - size: size, - align: align, + size, + align, packed: false, } } diff --git a/src/ir/template.rs b/src/ir/template.rs index f5cc0152..11a799f4 100644 --- a/src/ir/template.rs +++ b/src/ir/template.rs @@ -214,16 +214,13 @@ pub struct TemplateInstantiation { impl TemplateInstantiation { /// Construct a new template instantiation from the given parts. - pub fn new<I>( - template_definition: TypeId, - template_args: I, - ) -> TemplateInstantiation + pub fn new<I>(definition: TypeId, args: I) -> TemplateInstantiation where I: IntoIterator<Item = TypeId>, { TemplateInstantiation { - definition: template_definition, - args: template_args.into_iter().collect(), + definition, + args: args.into_iter().collect(), } } diff --git a/src/ir/traversal.rs b/src/ir/traversal.rs index f55acc10..b9b3179a 100644 --- a/src/ir/traversal.rs +++ b/src/ir/traversal.rs @@ -21,8 +21,8 @@ impl Edge { /// Construct a new edge whose referent is `to` and is of the given `kind`. pub fn new(to: ItemId, kind: EdgeKind) -> Edge { Edge { - to: to, - kind: kind, + to, + kind, } } } diff --git a/src/ir/ty.rs b/src/ir/ty.rs index 0db91385..12ecbc66 100644 --- a/src/ir/ty.rs +++ b/src/ir/ty.rs @@ -69,10 +69,10 @@ impl Type { is_const: bool, ) -> Self { Type { - name: name, - layout: layout, - kind: kind, - is_const: is_const, + name, + layout, + kind, + is_const, } } diff --git a/src/ir/var.rs b/src/ir/var.rs index 3abc44cf..9d6c1452 100644 --- a/src/ir/var.rs +++ b/src/ir/var.rs @@ -46,18 +46,18 @@ impl Var { /// Construct a new `Var`. pub fn new( name: String, - mangled: Option<String>, + mangled_name: Option<String>, ty: TypeId, val: Option<VarType>, is_const: bool, ) -> Var { assert!(!name.is_empty()); Var { - name: name, - mangled_name: mangled, - ty: ty, - val: val, - is_const: is_const, + name, + mangled_name, + ty, + val, + is_const, } } |