A-lintL-styleT-middlegood first issue
仓库指标
- Star
- (10,406 star)
- PR 合并指标
- (平均合并 19天 22小时) (30 天内合并 113 个 PR)
描述
Given this code:
struct Foo { cap: usize }
impl Foo {
fn new() -> Foo { Foo { cap: 1 } }
fn with_capacity(cap: usize) -> Foo {
Foo { cap: cap }
}
}
fn main() {}
In my opinion Clippy should suggest to replace four of those usages of "Foo" with "Self" and to remove one ": cap", making the code more DRY, the intended resulting code should be:
struct Foo { cap: usize }
impl Foo {
fn new() -> Self { Self { cap: 1 } }
fn with_capacity(cap: usize) -> Self {
Self { cap }
}
}
fn main() {}