Use the Self keyword where applicable.

https://github.com/rust-lang-nursery/rust-clippy/wiki#use_self
This commit is contained in:
Dan Gohman
2017-08-31 12:12:04 -07:00
parent 99b361567a
commit a7d629c368
7 changed files with 14 additions and 14 deletions

View File

@@ -51,8 +51,8 @@ where
{ {
/// Creates a ILBuilder structure. The structure is automatically cleared each time it is /// Creates a ILBuilder structure. The structure is automatically cleared each time it is
/// passed to a [`FunctionBuilder`](struct.FunctionBuilder.html) for creation. /// passed to a [`FunctionBuilder`](struct.FunctionBuilder.html) for creation.
pub fn new() -> ILBuilder<Variable> { pub fn new() -> Self {
ILBuilder { Self {
ssa: SSABuilder::new(), ssa: SSABuilder::new(),
ebbs: EntityMap::new(), ebbs: EntityMap::new(),
types: EntityMap::new(), types: EntityMap::new(),

View File

@@ -128,7 +128,7 @@ impl EntityRef for Block {
} }
impl ReservedValue for Block { impl ReservedValue for Block {
fn reserved_value() -> Block { fn reserved_value() -> Self {
Block(u32::MAX) Block(u32::MAX)
} }
} }
@@ -138,8 +138,8 @@ where
Variable: EntityRef + Default, Variable: EntityRef + Default,
{ {
/// Allocate a new blank SSA builder struct. Use the API function to interact with the struct. /// Allocate a new blank SSA builder struct. Use the API function to interact with the struct.
pub fn new() -> SSABuilder<Variable> { pub fn new() -> Self {
SSABuilder { Self {
variables: EntityMap::new(), variables: EntityMap::new(),
blocks: PrimaryMap::new(), blocks: PrimaryMap::new(),
ebb_headers: EntityMap::new(), ebb_headers: EntityMap::new(),

View File

@@ -185,8 +185,8 @@ pub trait MutableSourceMap {
} }
impl MutableSourceMap for SourceMap { impl MutableSourceMap for SourceMap {
fn new() -> SourceMap { fn new() -> Self {
SourceMap { Self {
values: HashMap::new(), values: HashMap::new(),
ebbs: HashMap::new(), ebbs: HashMap::new(),
stack_slots: HashMap::new(), stack_slots: HashMap::new(),

View File

@@ -144,8 +144,8 @@ pub struct FunctionImports {
} }
impl FunctionImports { impl FunctionImports {
fn new() -> FunctionImports { fn new() -> Self {
FunctionImports { Self {
functions: HashMap::new(), functions: HashMap::new(),
signatures: HashMap::new(), signatures: HashMap::new(),
} }

View File

@@ -46,8 +46,8 @@ pub struct ImportMappings {
impl ImportMappings { impl ImportMappings {
/// Create a new empty `ImportMappings`. /// Create a new empty `ImportMappings`.
pub fn new() -> ImportMappings { pub fn new() -> Self {
ImportMappings { Self {
functions: HashMap::new(), functions: HashMap::new(),
signatures: HashMap::new(), signatures: HashMap::new(),
} }

View File

@@ -15,8 +15,8 @@ pub struct DummyRuntime {
impl DummyRuntime { impl DummyRuntime {
/// Allocates the runtime data structures. /// Allocates the runtime data structures.
pub fn new() -> DummyRuntime { pub fn new() -> Self {
DummyRuntime { globals: Vec::new() } Self { globals: Vec::new() }
} }
} }

View File

@@ -98,7 +98,7 @@ impl cretonne::entity::EntityRef for Local {
} }
} }
impl Default for Local { impl Default for Local {
fn default() -> Local { fn default() -> Self {
Local(u32::MAX) Local(u32::MAX)
} }
} }