Use Self instead of repeating the type name.

This commit is contained in:
Dan Gohman
2017-11-08 10:40:47 -08:00
parent b7f979a8be
commit 3ab4349c1b
41 changed files with 105 additions and 105 deletions

View File

@@ -35,8 +35,8 @@ struct TextSink {
impl TextSink { impl TextSink {
/// Create a new empty TextSink. /// Create a new empty TextSink.
pub fn new(isa: &TargetIsa) -> TextSink { pub fn new(isa: &TargetIsa) -> Self {
TextSink { Self {
rnames: isa.reloc_names(), rnames: isa.reloc_names(),
offset: 0, offset: 0,
text: String::new(), text: String::new(),

View File

@@ -38,7 +38,7 @@ pub struct ConcurrentRunner {
impl ConcurrentRunner { impl ConcurrentRunner {
/// Create a new `ConcurrentRunner` with threads spun up. /// Create a new `ConcurrentRunner` with threads spun up.
pub fn new() -> ConcurrentRunner { pub fn new() -> Self {
let (request_tx, request_rx) = channel(); let (request_tx, request_rx) = channel();
let request_mutex = Arc::new(Mutex::new(request_rx)); let request_mutex = Arc::new(Mutex::new(request_rx));
let (reply_tx, reply_rx) = channel(); let (reply_tx, reply_rx) = channel();
@@ -51,7 +51,7 @@ impl ConcurrentRunner {
}) })
.collect(); .collect();
ConcurrentRunner { Self {
request_tx: Some(request_tx), request_tx: Some(request_tx),
reply_rx, reply_rx,
handles, handles,

View File

@@ -81,8 +81,8 @@ pub struct TestRunner {
impl TestRunner { impl TestRunner {
/// Create a new blank TrstRunner. /// Create a new blank TrstRunner.
pub fn new(verbose: bool) -> TestRunner { pub fn new(verbose: bool) -> Self {
TestRunner { Self {
verbose, verbose,
dir_stack: Vec::new(), dir_stack: Vec::new(),
tests: Vec::new(), tests: Vec::new(),

View File

@@ -61,7 +61,7 @@ where
} }
/// Construct a BitSet with the half-open range [lo,hi) filled in /// Construct a BitSet with the half-open range [lo,hi) filled in
pub fn from_range(lo: u8, hi: u8) -> BitSet<T> { pub fn from_range(lo: u8, hi: u8) -> Self {
assert!(lo <= hi); assert!(lo <= hi);
assert!((hi as usize) <= Self::bits()); assert!((hi as usize) <= Self::bits());
let one: T = T::from(1); let one: T = T::from(1);

View File

@@ -47,8 +47,8 @@ impl Context {
/// ///
/// The returned instance should be reused for compiling multiple functions in order to avoid /// The returned instance should be reused for compiling multiple functions in order to avoid
/// needless allocator thrashing. /// needless allocator thrashing.
pub fn new() -> Context { pub fn new() -> Self {
Context { Self {
func: Function::new(), func: Function::new(),
cfg: ControlFlowGraph::new(), cfg: ControlFlowGraph::new(),
domtree: DominatorTree::new(), domtree: DominatorTree::new(),

View File

@@ -204,8 +204,8 @@ impl DominatorTree {
impl DominatorTree { impl DominatorTree {
/// Allocate a new blank dominator tree. Use `compute` to compute the dominator tree for a /// Allocate a new blank dominator tree. Use `compute` to compute the dominator tree for a
/// function. /// function.
pub fn new() -> DominatorTree { pub fn new() -> Self {
DominatorTree { Self {
nodes: EntityMap::new(), nodes: EntityMap::new(),
postorder: Vec::new(), postorder: Vec::new(),
stack: Vec::new(), stack: Vec::new(),
@@ -214,8 +214,8 @@ impl DominatorTree {
} }
/// Allocate and compute a dominator tree. /// Allocate and compute a dominator tree.
pub fn with_function(func: &Function, cfg: &ControlFlowGraph) -> DominatorTree { pub fn with_function(func: &Function, cfg: &ControlFlowGraph) -> Self {
let mut domtree = DominatorTree::new(); let mut domtree = Self::new();
domtree.compute(func, cfg); domtree.compute(func, cfg);
domtree domtree
} }

View File

@@ -12,8 +12,8 @@ pub struct Keys<K: EntityRef> {
impl<K: EntityRef> Keys<K> { impl<K: EntityRef> Keys<K> {
/// Create a `Keys` iterator that visits `count` entities starting from 0. /// Create a `Keys` iterator that visits `count` entities starting from 0.
pub fn new(count: usize) -> Keys<K> { pub fn new(count: usize) -> Self {
Keys { Self {
pos: 0, pos: 0,
rev_pos: count, rev_pos: count,
unused: PhantomData, unused: PhantomData,

View File

@@ -68,7 +68,7 @@ pub struct EntityList<T: EntityRef> {
/// Create an empty list. /// Create an empty list.
impl<T: EntityRef> Default for EntityList<T> { impl<T: EntityRef> Default for EntityList<T> {
fn default() -> Self { fn default() -> Self {
EntityList { Self {
index: 0, index: 0,
unused: PhantomData, unused: PhantomData,
} }
@@ -82,7 +82,7 @@ impl<T: EntityRef> Hash for EntityList<T> {
} }
impl<T: EntityRef> PartialEq for EntityList<T> { impl<T: EntityRef> PartialEq for EntityList<T> {
fn eq(&self, _: &EntityList<T>) -> bool { fn eq(&self, _: &Self) -> bool {
panic!("eq called on EntityList"); panic!("eq called on EntityList");
} }
} }
@@ -121,8 +121,8 @@ fn is_sclass_min_length(len: usize) -> bool {
impl<T: EntityRef> ListPool<T> { impl<T: EntityRef> ListPool<T> {
/// Create a new list pool. /// Create a new list pool.
pub fn new() -> ListPool<T> { pub fn new() -> Self {
ListPool { Self {
data: Vec::new(), data: Vec::new(),
free: Vec::new(), free: Vec::new(),
} }
@@ -311,7 +311,7 @@ impl<T: EntityRef> EntityList<T> {
/// Take all elements from this list and return them as a new list. Leave this list empty. /// Take all elements from this list and return them as a new list. Leave this list empty.
/// ///
/// This is the equivalent of `Option::take()`. /// This is the equivalent of `Option::take()`.
pub fn take(&mut self) -> EntityList<T> { pub fn take(&mut self) -> Self {
mem::replace(self, Default::default()) mem::replace(self, Default::default())
} }

View File

@@ -34,7 +34,7 @@ where
where where
V: Default, V: Default,
{ {
EntityMap { Self {
elems: Vec::new(), elems: Vec::new(),
default: Default::default(), default: Default::default(),
unused: PhantomData, unused: PhantomData,
@@ -45,7 +45,7 @@ where
/// ///
/// This constructor does not require V to implement Default. /// This constructor does not require V to implement Default.
pub fn with_default(default: V) -> Self { pub fn with_default(default: V) -> Self {
EntityMap { Self {
elems: Vec::new(), elems: Vec::new(),
default: default, default: default,
unused: PhantomData, unused: PhantomData,

View File

@@ -27,7 +27,7 @@ where
{ {
/// Create a new empty map. /// Create a new empty map.
pub fn new() -> Self { pub fn new() -> Self {
PrimaryMap { Self {
elems: Vec::new(), elems: Vec::new(),
unused: PhantomData, unused: PhantomData,
} }

View File

@@ -24,7 +24,7 @@ where
{ {
/// Create a new empty set. /// Create a new empty set.
pub fn new() -> Self { pub fn new() -> Self {
EntitySet { Self {
elems: Vec::new(), elems: Vec::new(),
len: 0, len: 0,
unused: PhantomData, unused: PhantomData,

View File

@@ -66,7 +66,7 @@ where
{ {
/// Create a new empty mapping. /// Create a new empty mapping.
pub fn new() -> Self { pub fn new() -> Self {
SparseMap { Self {
sparse: EntityMap::new(), sparse: EntityMap::new(),
dense: Vec::new(), dense: Vec::new(),
} }
@@ -215,7 +215,7 @@ impl<T> SparseMapValue<T> for T
where where
T: EntityRef, T: EntityRef,
{ {
fn key(&self) -> T { fn key(&self) -> Self {
*self *self
} }
} }

View File

@@ -51,16 +51,16 @@ pub struct ControlFlowGraph {
impl ControlFlowGraph { impl ControlFlowGraph {
/// Allocate a new blank control flow graph. /// Allocate a new blank control flow graph.
pub fn new() -> ControlFlowGraph { pub fn new() -> Self {
ControlFlowGraph { Self {
data: EntityMap::new(), data: EntityMap::new(),
valid: false, valid: false,
} }
} }
/// Allocate and compute the control flow graph for `func`. /// Allocate and compute the control flow graph for `func`.
pub fn with_function(func: &Function) -> ControlFlowGraph { pub fn with_function(func: &Function) -> Self {
let mut cfg = ControlFlowGraph::new(); let mut cfg = Self::new();
cfg.compute(func); cfg.compute(func);
cfg cfg
} }

View File

@@ -62,8 +62,8 @@ pub struct DataFlowGraph {
impl DataFlowGraph { impl DataFlowGraph {
/// Create a new empty `DataFlowGraph`. /// Create a new empty `DataFlowGraph`.
pub fn new() -> DataFlowGraph { pub fn new() -> Self {
DataFlowGraph { Self {
insts: PrimaryMap::new(), insts: PrimaryMap::new(),
results: EntityMap::new(), results: EntityMap::new(),
ebbs: PrimaryMap::new(), ebbs: PrimaryMap::new(),
@@ -829,8 +829,8 @@ struct EbbData {
} }
impl EbbData { impl EbbData {
fn new() -> EbbData { fn new() -> Self {
EbbData { params: ValueList::new() } Self { params: ValueList::new() }
} }
} }

View File

@@ -38,8 +38,8 @@ pub struct Signature {
impl Signature { impl Signature {
/// Create a new blank signature. /// Create a new blank signature.
pub fn new(call_conv: CallConv) -> Signature { pub fn new(call_conv: CallConv) -> Self {
Signature { Self {
params: Vec::new(), params: Vec::new(),
returns: Vec::new(), returns: Vec::new(),
call_conv, call_conv,
@@ -138,8 +138,8 @@ pub struct AbiParam {
impl AbiParam { impl AbiParam {
/// Create a parameter with default flags. /// Create a parameter with default flags.
pub fn new(vt: Type) -> AbiParam { pub fn new(vt: Type) -> Self {
AbiParam { Self {
value_type: vt, value_type: vt,
extension: ArgumentExtension::None, extension: ArgumentExtension::None,
purpose: ArgumentPurpose::Normal, purpose: ArgumentPurpose::Normal,
@@ -148,8 +148,8 @@ impl AbiParam {
} }
/// Create a special-purpose parameter that is not (yet) bound to a specific register. /// Create a special-purpose parameter that is not (yet) bound to a specific register.
pub fn special(vt: Type, purpose: ArgumentPurpose) -> AbiParam { pub fn special(vt: Type, purpose: ArgumentPurpose) -> Self {
AbiParam { Self {
value_type: vt, value_type: vt,
extension: ArgumentExtension::None, extension: ArgumentExtension::None,
purpose, purpose,
@@ -158,8 +158,8 @@ impl AbiParam {
} }
/// Create a parameter for a special-purpose register. /// Create a parameter for a special-purpose register.
pub fn special_reg(vt: Type, purpose: ArgumentPurpose, regunit: RegUnit) -> AbiParam { pub fn special_reg(vt: Type, purpose: ArgumentPurpose, regunit: RegUnit) -> Self {
AbiParam { Self {
value_type: vt, value_type: vt,
extension: ArgumentExtension::None, extension: ArgumentExtension::None,
purpose, purpose,
@@ -168,18 +168,18 @@ impl AbiParam {
} }
/// Convert `self` to a parameter with the `uext` flag set. /// Convert `self` to a parameter with the `uext` flag set.
pub fn uext(self) -> AbiParam { pub fn uext(self) -> Self {
debug_assert!(self.value_type.is_int(), "uext on {} arg", self.value_type); debug_assert!(self.value_type.is_int(), "uext on {} arg", self.value_type);
AbiParam { Self {
extension: ArgumentExtension::Uext, extension: ArgumentExtension::Uext,
..self ..self
} }
} }
/// Convert `self` to a parameter type with the `sext` flag set. /// Convert `self` to a parameter type with the `sext` flag set.
pub fn sext(self) -> AbiParam { pub fn sext(self) -> Self {
debug_assert!(self.value_type.is_int(), "sext on {} arg", self.value_type); debug_assert!(self.value_type.is_int(), "sext on {} arg", self.value_type);
AbiParam { Self {
extension: ArgumentExtension::Sext, extension: ArgumentExtension::Sext,
..self ..self
} }

View File

@@ -66,8 +66,8 @@ pub struct Function {
impl Function { impl Function {
/// Create a function with the given name and signature. /// Create a function with the given name and signature.
pub fn with_name_signature(name: ExternalName, sig: Signature) -> Function { pub fn with_name_signature(name: ExternalName, sig: Signature) -> Self {
Function { Self {
name, name,
signature: sig, signature: sig,
stack_slots: StackSlots::new(), stack_slots: StackSlots::new(),
@@ -99,7 +99,7 @@ impl Function {
} }
/// Create a new empty, anonymous function with a native calling convention. /// Create a new empty, anonymous function with a native calling convention.
pub fn new() -> Function { pub fn new() -> Self {
Self::with_name_signature(ExternalName::default(), Signature::new(CallConv::Native)) Self::with_name_signature(ExternalName::default(), Signature::new(CallConv::Native))
} }

View File

@@ -262,7 +262,7 @@ pub struct VariableArgs(Vec<Value>);
impl VariableArgs { impl VariableArgs {
/// Create an empty argument list. /// Create an empty argument list.
pub fn new() -> VariableArgs { pub fn new() -> Self {
VariableArgs(Vec::new()) VariableArgs(Vec::new())
} }
@@ -314,8 +314,8 @@ impl Display for VariableArgs {
} }
impl Default for VariableArgs { impl Default for VariableArgs {
fn default() -> VariableArgs { fn default() -> Self {
VariableArgs::new() Self::new()
} }
} }

View File

@@ -24,16 +24,16 @@ pub struct JumpTableData {
impl JumpTableData { impl JumpTableData {
/// Create a new empty jump table. /// Create a new empty jump table.
pub fn new() -> JumpTableData { pub fn new() -> Self {
JumpTableData { Self {
table: Vec::new(), table: Vec::new(),
holes: 0, holes: 0,
} }
} }
/// Create a new empty jump table with the specified capacity. /// Create a new empty jump table with the specified capacity.
pub fn with_capacity(capacity: usize) -> JumpTableData { pub fn with_capacity(capacity: usize) -> Self {
JumpTableData { Self {
table: Vec::with_capacity(capacity), table: Vec::with_capacity(capacity),
holes: 0, holes: 0,
} }

View File

@@ -42,8 +42,8 @@ pub struct Layout {
impl Layout { impl Layout {
/// Create a new empty `Layout`. /// Create a new empty `Layout`.
pub fn new() -> Layout { pub fn new() -> Self {
Layout { Self {
ebbs: EntityMap::new(), ebbs: EntityMap::new(),
insts: EntityMap::new(), insts: EntityMap::new(),
first_ebb: None, first_ebb: None,

View File

@@ -21,8 +21,8 @@ pub struct MemFlags {
impl MemFlags { impl MemFlags {
/// Create a new empty set of flags. /// Create a new empty set of flags.
pub fn new() -> MemFlags { pub fn new() -> Self {
MemFlags { bits: 0 } Self { bits: 0 }
} }
/// Read a flag bit. /// Read a flag bit.

View File

@@ -33,7 +33,7 @@ impl SourceLoc {
} }
impl Default for SourceLoc { impl Default for SourceLoc {
fn default() -> SourceLoc { fn default() -> Self {
SourceLoc(!0) SourceLoc(!0)
} }
} }

View File

@@ -172,8 +172,8 @@ pub struct StackSlots {
/// Stack slot manager functions that behave mostly like an entity map. /// Stack slot manager functions that behave mostly like an entity map.
impl StackSlots { impl StackSlots {
/// Create an empty stack slot manager. /// Create an empty stack slot manager.
pub fn new() -> StackSlots { pub fn new() -> Self {
StackSlots { Self {
slots: PrimaryMap::new(), slots: PrimaryMap::new(),
outgoing: Vec::new(), outgoing: Vec::new(),
emergency: Vec::new(), emergency: Vec::new(),

View File

@@ -321,7 +321,7 @@ impl Debug for Type {
} }
impl Default for Type { impl Default for Type {
fn default() -> Type { fn default() -> Self {
VOID VOID
} }
} }

View File

@@ -214,7 +214,7 @@ impl fmt::Debug for RegClassData {
/// Within an ISA, register classes are uniquely identified by their index. /// Within an ISA, register classes are uniquely identified by their index.
impl PartialEq for RegClassData { impl PartialEq for RegClassData {
fn eq(&self, other: &RegClassData) -> bool { fn eq(&self, other: &Self) -> bool {
self.index == other.index self.index == other.index
} }
} }

View File

@@ -42,8 +42,8 @@ impl LoopData {
impl LoopAnalysis { impl LoopAnalysis {
/// Allocate a new blank loop analysis struct. Use `compute` to compute the loop analysis for /// Allocate a new blank loop analysis struct. Use `compute` to compute the loop analysis for
/// a function. /// a function.
pub fn new() -> LoopAnalysis { pub fn new() -> Self {
LoopAnalysis { Self {
valid: false, valid: false,
loops: PrimaryMap::new(), loops: PrimaryMap::new(),
ebb_loop_map: EntityMap::new(), ebb_loop_map: EntityMap::new(),

View File

@@ -37,8 +37,8 @@ impl AllocatableSet {
/// ///
/// Note that this includes *all* registers. Query the `TargetIsa` object to get a set of /// Note that this includes *all* registers. Query the `TargetIsa` object to get a set of
/// allocatable registers where reserved registers have been filtered out. /// allocatable registers where reserved registers have been filtered out.
pub fn new() -> AllocatableSet { pub fn new() -> Self {
AllocatableSet { avail: [!0; 3] } Self { avail: [!0; 3] }
} }
/// Returns `true` if the specified register is available. /// Returns `true` if the specified register is available.

View File

@@ -74,8 +74,8 @@ impl Node {
impl DomForest { impl DomForest {
/// Create a new empty dominator forest. /// Create a new empty dominator forest.
pub fn new() -> DomForest { pub fn new() -> Self {
DomForest { Self {
values: Vec::new(), values: Vec::new(),
stack: Vec::new(), stack: Vec::new(),
} }
@@ -252,8 +252,8 @@ struct Context<'a> {
impl Coalescing { impl Coalescing {
/// Create a new coalescing pass. /// Create a new coalescing pass.
pub fn new() -> Coalescing { pub fn new() -> Self {
Coalescing { Self {
forest: DomForest::new(), forest: DomForest::new(),
values: Vec::new(), values: Vec::new(),
split_values: Vec::new(), split_values: Vec::new(),

View File

@@ -101,8 +101,8 @@ struct Context<'a> {
impl Coloring { impl Coloring {
/// Allocate scratch space data structures for the coloring pass. /// Allocate scratch space data structures for the coloring pass.
pub fn new() -> Coloring { pub fn new() -> Self {
Coloring { Self {
divert: RegDiversions::new(), divert: RegDiversions::new(),
solver: Solver::new(), solver: Solver::new(),
} }

View File

@@ -36,8 +36,8 @@ impl Context {
/// ///
/// This context should be reused for multiple functions in order to avoid repeated memory /// This context should be reused for multiple functions in order to avoid repeated memory
/// allocations. /// allocations.
pub fn new() -> Context { pub fn new() -> Self {
Context { Self {
liveness: Liveness::new(), liveness: Liveness::new(),
virtregs: VirtRegs::new(), virtregs: VirtRegs::new(),
coalescing: Coalescing::new(), coalescing: Coalescing::new(),

View File

@@ -44,8 +44,8 @@ pub struct RegDiversions {
impl RegDiversions { impl RegDiversions {
/// Create a new empty diversion tracker. /// Create a new empty diversion tracker.
pub fn new() -> RegDiversions { pub fn new() -> Self {
RegDiversions { current: Vec::new() } Self { current: Vec::new() }
} }
/// Clear the tracker, preparing for a new EBB. /// Clear the tracker, preparing for a new EBB.

View File

@@ -65,8 +65,8 @@ struct LiveValueVec {
} }
impl LiveValueVec { impl LiveValueVec {
fn new() -> LiveValueVec { fn new() -> Self {
LiveValueVec { Self {
values: Vec::new(), values: Vec::new(),
live_prefix: None, live_prefix: None,
} }
@@ -124,8 +124,8 @@ impl LiveValueVec {
impl LiveValueTracker { impl LiveValueTracker {
/// Create a new blank tracker. /// Create a new blank tracker.
pub fn new() -> LiveValueTracker { pub fn new() -> Self {
LiveValueTracker { Self {
live: LiveValueVec::new(), live: LiveValueVec::new(),
idom_sets: HashMap::new(), idom_sets: HashMap::new(),
idom_pool: ListPool::new(), idom_pool: ListPool::new(),

View File

@@ -299,8 +299,8 @@ impl Liveness {
/// ///
/// The memory allocated for this analysis can be reused for multiple functions. Use the /// The memory allocated for this analysis can be reused for multiple functions. Use the
/// `compute` method to actually runs the analysis for a function. /// `compute` method to actually runs the analysis for a function.
pub fn new() -> Liveness { pub fn new() -> Self {
Liveness { Self {
ranges: LiveRangeSet::new(), ranges: LiveRangeSet::new(),
worklist: Vec::new(), worklist: Vec::new(),
ebb_params: Vec::new(), ebb_params: Vec::new(),

View File

@@ -46,8 +46,8 @@ struct Context<'a> {
impl Reload { impl Reload {
/// Create a new blank reload pass. /// Create a new blank reload pass.
pub fn new() -> Reload { pub fn new() -> Self {
Reload { Self {
candidates: Vec::new(), candidates: Vec::new(),
reloads: SparseMap::new(), reloads: SparseMap::new(),
} }

View File

@@ -502,8 +502,8 @@ pub struct Solver {
/// Interface for programming the constraints into the solver. /// Interface for programming the constraints into the solver.
impl Solver { impl Solver {
/// Create a new empty solver. /// Create a new empty solver.
pub fn new() -> Solver { pub fn new() -> Self {
Solver { Self {
assignments: SparseMap::new(), assignments: SparseMap::new(),
vars: Vec::new(), vars: Vec::new(),
inputs_done: false, inputs_done: false,

View File

@@ -63,8 +63,8 @@ struct Context<'a> {
impl Spilling { impl Spilling {
/// Create a new spilling data structure. /// Create a new spilling data structure.
pub fn new() -> Spilling { pub fn new() -> Self {
Spilling { Self {
spills: Vec::new(), spills: Vec::new(),
reg_uses: Vec::new(), reg_uses: Vec::new(),
} }

View File

@@ -45,8 +45,8 @@ pub struct VirtRegs {
#[allow(dead_code)] #[allow(dead_code)]
impl VirtRegs { impl VirtRegs {
/// Create a new virtual register collection. /// Create a new virtual register collection.
pub fn new() -> VirtRegs { pub fn new() -> Self {
VirtRegs { Self {
pool: ListPool::new(), pool: ListPool::new(),
vregs: PrimaryMap::new(), vregs: PrimaryMap::new(),
value_vregs: EntityMap::new(), value_vregs: EntityMap::new(),

View File

@@ -26,8 +26,8 @@ pub struct TopoOrder {
impl TopoOrder { impl TopoOrder {
/// Create a new empty topological order. /// Create a new empty topological order.
pub fn new() -> TopoOrder { pub fn new() -> Self {
TopoOrder { Self {
preferred: Vec::new(), preferred: Vec::new(),
next: 0, next: 0,
visited: SparseSet::new(), visited: SparseSet::new(),

View File

@@ -95,8 +95,8 @@ pub struct CheckerBuilder {
impl CheckerBuilder { impl CheckerBuilder {
/// Create a new, blank `CheckerBuilder`. /// Create a new, blank `CheckerBuilder`.
pub fn new() -> CheckerBuilder { pub fn new() -> Self {
CheckerBuilder { Self {
directives: Vec::new(), directives: Vec::new(),
linerx: Regex::new(DIRECTIVE_RX).unwrap(), linerx: Regex::new(DIRECTIVE_RX).unwrap(),
} }
@@ -146,8 +146,8 @@ pub struct Checker {
} }
impl Checker { impl Checker {
fn new(directives: Vec<Directive>) -> Checker { fn new(directives: Vec<Directive>) -> Self {
Checker { directives: directives } Self { directives: directives }
} }
/// An empty checker contains no directives, and will match any input string. /// An empty checker contains no directives, and will match any input string.

View File

@@ -54,8 +54,8 @@ impl Part {
impl Pattern { impl Pattern {
/// Create a new blank pattern. Use the `FromStr` trait to generate Patterns with content. /// Create a new blank pattern. Use the `FromStr` trait to generate Patterns with content.
fn new() -> Pattern { fn new() -> Self {
Pattern { Self {
parts: Vec::new(), parts: Vec::new(),
defs: Vec::new(), defs: Vec::new(),
} }

View File

@@ -30,8 +30,8 @@ pub struct FuncTranslator {
impl FuncTranslator { impl FuncTranslator {
/// Create a new translator. /// Create a new translator.
pub fn new() -> FuncTranslator { pub fn new() -> Self {
FuncTranslator { Self {
il_builder: ILBuilder::new(), il_builder: ILBuilder::new(),
state: TranslationState::new(), state: TranslationState::new(),
} }

View File

@@ -126,8 +126,8 @@ pub struct TranslationState {
} }
impl TranslationState { impl TranslationState {
pub fn new() -> TranslationState { pub fn new() -> Self {
TranslationState { Self {
stack: Vec::new(), stack: Vec::new(),
control_stack: Vec::new(), control_stack: Vec::new(),
phantom_unreachable_stack_depth: 0, phantom_unreachable_stack_depth: 0,