Use Self instead of repeating the type name.
This commit is contained in:
@@ -95,8 +95,8 @@ pub struct CheckerBuilder {
|
||||
|
||||
impl CheckerBuilder {
|
||||
/// Create a new, blank `CheckerBuilder`.
|
||||
pub fn new() -> CheckerBuilder {
|
||||
CheckerBuilder {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
directives: Vec::new(),
|
||||
linerx: Regex::new(DIRECTIVE_RX).unwrap(),
|
||||
}
|
||||
@@ -146,8 +146,8 @@ pub struct Checker {
|
||||
}
|
||||
|
||||
impl Checker {
|
||||
fn new(directives: Vec<Directive>) -> Checker {
|
||||
Checker { directives: directives }
|
||||
fn new(directives: Vec<Directive>) -> Self {
|
||||
Self { directives: directives }
|
||||
}
|
||||
|
||||
/// An empty checker contains no directives, and will match any input string.
|
||||
|
||||
@@ -54,8 +54,8 @@ impl Part {
|
||||
|
||||
impl Pattern {
|
||||
/// Create a new blank pattern. Use the `FromStr` trait to generate Patterns with content.
|
||||
fn new() -> Pattern {
|
||||
Pattern {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
parts: Vec::new(),
|
||||
defs: Vec::new(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user