diff options
Diffstat (limited to 'src/tools/clippy/src/docs/use_self.txt')
-rw-r--r-- | src/tools/clippy/src/docs/use_self.txt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/use_self.txt b/src/tools/clippy/src/docs/use_self.txt new file mode 100644 index 000000000..bd37ed1e0 --- /dev/null +++ b/src/tools/clippy/src/docs/use_self.txt @@ -0,0 +1,31 @@ +### What it does +Checks for unnecessary repetition of structure name when a +replacement with `Self` is applicable. + +### Why is this bad? +Unnecessary repetition. Mixed use of `Self` and struct +name +feels inconsistent. + +### Known problems +- Unaddressed false negative in fn bodies of trait implementations +- False positive with associated types in traits (#4140) + +### Example +``` +struct Foo; +impl Foo { + fn new() -> Foo { + Foo {} + } +} +``` +could be +``` +struct Foo; +impl Foo { + fn new() -> Self { + Self {} + } +} +```
\ No newline at end of file |