mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
add test for trait recursion
This commit is contained in:
parent
c4a3ccde78
commit
e4766776d2
2 changed files with 17 additions and 1 deletions
|
@ -86,6 +86,16 @@ impl B for A {
|
|||
}
|
||||
}
|
||||
|
||||
trait C {
|
||||
fn hello(a: usize, b: usize) -> usize {
|
||||
if a == 0 { 1 } else { Self::hello(a - 1, b + 1) }
|
||||
}
|
||||
|
||||
fn hello2(&self, a: usize, b: usize) -> usize {
|
||||
if a == 0 { 1 } else { self.hello2(a - 1, b + 1) }
|
||||
}
|
||||
}
|
||||
|
||||
fn ignore(a: usize, _: usize) -> usize {
|
||||
if a == 1 { 1 } else { ignore(a - 1, 0) }
|
||||
}
|
||||
|
|
|
@ -66,5 +66,11 @@ error: parameter is only used in recursion
|
|||
LL | fn method2(&self, a: usize, b: usize) -> usize {
|
||||
| ^ help: if this is intentional, prefix with an underscore: `_b`
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
error: parameter is only used in recursion
|
||||
--> $DIR/only_used_in_recursion.rs:94:32
|
||||
|
|
||||
LL | fn hello2(&self, a: usize, b: usize) -> usize {
|
||||
| ^ help: if this is intentional, prefix with an underscore: `_b`
|
||||
|
||||
error: aborting due to 12 previous errors
|
||||
|
||||
|
|
Loading…
Reference in a new issue