Skip to content

Commit 8210981

Browse files
Add ui test for multiple_bound_locations lint
1 parent 13955c7 commit 8210981

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

tests/ui/multiple_bound_locations.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#![warn(clippy::multiple_bound_locations)]
2+
3+
fn ty<F: std::fmt::Debug>(a: F)
4+
//~^ ERROR: bound is defined in more than one place
5+
where
6+
F: Sized,
7+
{
8+
}
9+
10+
fn lifetime<'a, 'b: 'a, 'c>(a: &'b str, b: &'a str, c: &'c str)
11+
//~^ ERROR: bound is defined in more than one place
12+
where
13+
'b: 'c,
14+
{
15+
}
16+
17+
fn ty_pred<F: Sized>()
18+
//~^ ERROR: bound is defined in more than one place
19+
where
20+
for<'a> F: Send + 'a,
21+
{
22+
}
23+
24+
fn main() {}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
error: bound is defined in more than one place
2+
--> $DIR/multiple_bound_locations.rs:3:7
3+
|
4+
LL | fn ty<F: std::fmt::Debug>(a: F)
5+
| ^
6+
...
7+
LL | F: Sized
8+
| ^
9+
|
10+
= note: `-D clippy::multiple-bound-locations` implied by `-D warnings`
11+
= help: to override `-D warnings` add `#[allow(clippy::multiple_bound_locations)]`
12+
13+
error: bound is defined in more than one place
14+
--> $DIR/multiple_bound_locations.rs:9:17
15+
|
16+
LL | fn lifetime<'a, 'b: 'a, 'c>(a: &'b str, b: &'a str, c: &'c str)
17+
| ^^
18+
...
19+
LL | 'b: 'c
20+
| ^^
21+
22+
error: bound is defined in more than one place
23+
--> $DIR/multiple_bound_locations.rs:15:12
24+
|
25+
LL | fn ty_pred<F: Sized>()
26+
| ^
27+
...
28+
LL | for<'a> F: Send + 'a
29+
| ^
30+
31+
error: aborting due to 3 previous errors
32+

0 commit comments

Comments
 (0)