diff --git a/lib/frontend/src/frontend.rs b/lib/frontend/src/frontend.rs index 008610f62e..0210e43a56 100644 --- a/lib/frontend/src/frontend.rs +++ b/lib/frontend/src/frontend.rs @@ -51,8 +51,8 @@ where { /// Creates a ILBuilder structure. The structure is automatically cleared each time it is /// passed to a [`FunctionBuilder`](struct.FunctionBuilder.html) for creation. - pub fn new() -> ILBuilder { - ILBuilder { + pub fn new() -> Self { + Self { ssa: SSABuilder::new(), ebbs: EntityMap::new(), types: EntityMap::new(), diff --git a/lib/frontend/src/ssa.rs b/lib/frontend/src/ssa.rs index 509da5f592..3fefb4e555 100644 --- a/lib/frontend/src/ssa.rs +++ b/lib/frontend/src/ssa.rs @@ -128,7 +128,7 @@ impl EntityRef for Block { } impl ReservedValue for Block { - fn reserved_value() -> Block { + fn reserved_value() -> Self { Block(u32::MAX) } } @@ -138,8 +138,8 @@ where Variable: EntityRef + Default, { /// Allocate a new blank SSA builder struct. Use the API function to interact with the struct. - pub fn new() -> SSABuilder { - SSABuilder { + pub fn new() -> Self { + Self { variables: EntityMap::new(), blocks: PrimaryMap::new(), ebb_headers: EntityMap::new(), diff --git a/lib/reader/src/sourcemap.rs b/lib/reader/src/sourcemap.rs index 2135e5e037..05d7e3ca3e 100644 --- a/lib/reader/src/sourcemap.rs +++ b/lib/reader/src/sourcemap.rs @@ -185,8 +185,8 @@ pub trait MutableSourceMap { } impl MutableSourceMap for SourceMap { - fn new() -> SourceMap { - SourceMap { + fn new() -> Self { + Self { values: HashMap::new(), ebbs: HashMap::new(), stack_slots: HashMap::new(), diff --git a/lib/wasm/src/code_translator.rs b/lib/wasm/src/code_translator.rs index a98c9ad4f5..91dfb00281 100644 --- a/lib/wasm/src/code_translator.rs +++ b/lib/wasm/src/code_translator.rs @@ -144,8 +144,8 @@ pub struct FunctionImports { } impl FunctionImports { - fn new() -> FunctionImports { - FunctionImports { + fn new() -> Self { + Self { functions: HashMap::new(), signatures: HashMap::new(), } diff --git a/lib/wasm/src/module_translator.rs b/lib/wasm/src/module_translator.rs index 22bf59d17e..a5949fef30 100644 --- a/lib/wasm/src/module_translator.rs +++ b/lib/wasm/src/module_translator.rs @@ -46,8 +46,8 @@ pub struct ImportMappings { impl ImportMappings { /// Create a new empty `ImportMappings`. - pub fn new() -> ImportMappings { - ImportMappings { + pub fn new() -> Self { + Self { functions: HashMap::new(), signatures: HashMap::new(), } diff --git a/lib/wasm/src/runtime/dummy.rs b/lib/wasm/src/runtime/dummy.rs index c6e1741dc2..05d7cbfaa3 100644 --- a/lib/wasm/src/runtime/dummy.rs +++ b/lib/wasm/src/runtime/dummy.rs @@ -15,8 +15,8 @@ pub struct DummyRuntime { impl DummyRuntime { /// Allocates the runtime data structures. - pub fn new() -> DummyRuntime { - DummyRuntime { globals: Vec::new() } + pub fn new() -> Self { + Self { globals: Vec::new() } } } diff --git a/lib/wasm/src/translation_utils.rs b/lib/wasm/src/translation_utils.rs index 15099f475b..4a7f375bb8 100644 --- a/lib/wasm/src/translation_utils.rs +++ b/lib/wasm/src/translation_utils.rs @@ -98,7 +98,7 @@ impl cretonne::entity::EntityRef for Local { } } impl Default for Local { - fn default() -> Local { + fn default() -> Self { Local(u32::MAX) } }