Skip to content

Commit 19efedb

Browse files
committed
Bless clippy.
1 parent 29ba3ab commit 19efedb

File tree

6 files changed

+87
-166
lines changed

6 files changed

+87
-166
lines changed

src/tools/clippy/tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ async fn bad() -> u32 {
77
}
88

99
async fn bad_reason() -> u32 {
10-
let _x = Ipv4Addr::new(127, 0, 0, 1);
11-
baz().await
10+
let x = Ipv4Addr::new(127, 0, 0, 1);
11+
let y = baz().await;
12+
let _x = x;
13+
y
1214
}
1315

1416
async fn good() -> u32 {

src/tools/clippy/tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ LL | let _x = String::from("hello");
1111
error: `std::net::Ipv4Addr` may not be held across an `await` point per `clippy.toml`
1212
--> $DIR/await_holding_invalid_type.rs:10:9
1313
|
14-
LL | let _x = Ipv4Addr::new(127, 0, 0, 1);
15-
| ^^
14+
LL | let x = Ipv4Addr::new(127, 0, 0, 1);
15+
| ^
1616

1717
error: `std::string::String` may not be held across an `await` point per `clippy.toml`
18-
--> $DIR/await_holding_invalid_type.rs:31:13
18+
--> $DIR/await_holding_invalid_type.rs:33:13
1919
|
2020
LL | let _x = String::from("hi!");
2121
| ^^

src/tools/clippy/tests/ui/await_holding_lock.stderr

Lines changed: 48 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@ LL | let guard = x.lock().unwrap();
66
|
77
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
88
note: these are all the `await` points this lock is held through
9-
--> $DIR/await_holding_lock.rs:9:9
9+
--> $DIR/await_holding_lock.rs:11:15
1010
|
11-
LL | / let guard = x.lock().unwrap();
12-
LL | |
13-
LL | | baz().await
14-
LL | | }
15-
| |_____^
11+
LL | baz().await
12+
| ^^^^^
1613
= note: `-D clippy::await-holding-lock` implied by `-D warnings`
1714
= help: to override `-D warnings` add `#[allow(clippy::await_holding_lock)]`
1815

@@ -24,13 +21,10 @@ LL | let guard = x.read().unwrap();
2421
|
2522
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
2623
note: these are all the `await` points this lock is held through
27-
--> $DIR/await_holding_lock.rs:25:9
24+
--> $DIR/await_holding_lock.rs:27:15
2825
|
29-
LL | / let guard = x.read().unwrap();
30-
LL | |
31-
LL | | baz().await
32-
LL | | }
33-
| |_____^
26+
LL | baz().await
27+
| ^^^^^
3428

3529
error: this `MutexGuard` is held across an `await` point
3630
--> $DIR/await_holding_lock.rs:31:13
@@ -40,13 +34,10 @@ LL | let mut guard = x.write().unwrap();
4034
|
4135
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
4236
note: these are all the `await` points this lock is held through
43-
--> $DIR/await_holding_lock.rs:31:9
37+
--> $DIR/await_holding_lock.rs:33:15
4438
|
45-
LL | / let mut guard = x.write().unwrap();
46-
LL | |
47-
LL | | baz().await
48-
LL | | }
49-
| |_____^
39+
LL | baz().await
40+
| ^^^^^
5041

5142
error: this `MutexGuard` is held across an `await` point
5243
--> $DIR/await_holding_lock.rs:53:13
@@ -56,16 +47,13 @@ LL | let guard = x.lock().unwrap();
5647
|
5748
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
5849
note: these are all the `await` points this lock is held through
59-
--> $DIR/await_holding_lock.rs:53:9
60-
|
61-
LL | / let guard = x.lock().unwrap();
62-
LL | |
63-
LL | |
64-
LL | | let second = baz().await;
65-
... |
66-
LL | | first + second + third
67-
LL | | }
68-
| |_____^
50+
--> $DIR/await_holding_lock.rs:56:28
51+
|
52+
LL | let second = baz().await;
53+
| ^^^^^
54+
LL |
55+
LL | let third = baz().await;
56+
| ^^^^^
6957

7058
error: this `MutexGuard` is held across an `await` point
7159
--> $DIR/await_holding_lock.rs:67:17
@@ -75,13 +63,10 @@ LL | let guard = x.lock().unwrap();
7563
|
7664
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
7765
note: these are all the `await` points this lock is held through
78-
--> $DIR/await_holding_lock.rs:67:13
66+
--> $DIR/await_holding_lock.rs:69:19
7967
|
80-
LL | / let guard = x.lock().unwrap();
81-
LL | |
82-
LL | | baz().await
83-
LL | | };
84-
| |_________^
68+
LL | baz().await
69+
| ^^^^^
8570

8671
error: this `MutexGuard` is held across an `await` point
8772
--> $DIR/await_holding_lock.rs:80:17
@@ -91,13 +76,10 @@ LL | let guard = x.lock().unwrap();
9176
|
9277
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
9378
note: these are all the `await` points this lock is held through
94-
--> $DIR/await_holding_lock.rs:80:13
79+
--> $DIR/await_holding_lock.rs:82:19
9580
|
96-
LL | / let guard = x.lock().unwrap();
97-
LL | |
98-
LL | | baz().await
99-
LL | | }
100-
| |_________^
81+
LL | baz().await
82+
| ^^^^^
10183

10284
error: this `MutexGuard` is held across an `await` point
10385
--> $DIR/await_holding_lock.rs:93:13
@@ -107,13 +89,10 @@ LL | let guard = x.lock();
10789
|
10890
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
10991
note: these are all the `await` points this lock is held through
110-
--> $DIR/await_holding_lock.rs:93:9
92+
--> $DIR/await_holding_lock.rs:95:15
11193
|
112-
LL | / let guard = x.lock();
113-
LL | |
114-
LL | | baz().await
115-
LL | | }
116-
| |_____^
94+
LL | baz().await
95+
| ^^^^^
11796

11897
error: this `MutexGuard` is held across an `await` point
11998
--> $DIR/await_holding_lock.rs:109:13
@@ -123,13 +102,10 @@ LL | let guard = x.read();
123102
|
124103
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
125104
note: these are all the `await` points this lock is held through
126-
--> $DIR/await_holding_lock.rs:109:9
105+
--> $DIR/await_holding_lock.rs:111:15
127106
|
128-
LL | / let guard = x.read();
129-
LL | |
130-
LL | | baz().await
131-
LL | | }
132-
| |_____^
107+
LL | baz().await
108+
| ^^^^^
133109

134110
error: this `MutexGuard` is held across an `await` point
135111
--> $DIR/await_holding_lock.rs:115:13
@@ -139,13 +115,10 @@ LL | let mut guard = x.write();
139115
|
140116
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
141117
note: these are all the `await` points this lock is held through
142-
--> $DIR/await_holding_lock.rs:115:9
118+
--> $DIR/await_holding_lock.rs:117:15
143119
|
144-
LL | / let mut guard = x.write();
145-
LL | |
146-
LL | | baz().await
147-
LL | | }
148-
| |_____^
120+
LL | baz().await
121+
| ^^^^^
149122

150123
error: this `MutexGuard` is held across an `await` point
151124
--> $DIR/await_holding_lock.rs:137:13
@@ -155,16 +128,13 @@ LL | let guard = x.lock();
155128
|
156129
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
157130
note: these are all the `await` points this lock is held through
158-
--> $DIR/await_holding_lock.rs:137:9
159-
|
160-
LL | / let guard = x.lock();
161-
LL | |
162-
LL | |
163-
LL | | let second = baz().await;
164-
... |
165-
LL | | first + second + third
166-
LL | | }
167-
| |_____^
131+
--> $DIR/await_holding_lock.rs:140:28
132+
|
133+
LL | let second = baz().await;
134+
| ^^^^^
135+
LL |
136+
LL | let third = baz().await;
137+
| ^^^^^
168138

169139
error: this `MutexGuard` is held across an `await` point
170140
--> $DIR/await_holding_lock.rs:151:17
@@ -174,13 +144,10 @@ LL | let guard = x.lock();
174144
|
175145
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
176146
note: these are all the `await` points this lock is held through
177-
--> $DIR/await_holding_lock.rs:151:13
147+
--> $DIR/await_holding_lock.rs:153:19
178148
|
179-
LL | / let guard = x.lock();
180-
LL | |
181-
LL | | baz().await
182-
LL | | };
183-
| |_________^
149+
LL | baz().await
150+
| ^^^^^
184151

185152
error: this `MutexGuard` is held across an `await` point
186153
--> $DIR/await_holding_lock.rs:164:17
@@ -190,13 +157,10 @@ LL | let guard = x.lock();
190157
|
191158
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
192159
note: these are all the `await` points this lock is held through
193-
--> $DIR/await_holding_lock.rs:164:13
160+
--> $DIR/await_holding_lock.rs:166:19
194161
|
195-
LL | / let guard = x.lock();
196-
LL | |
197-
LL | | baz().await
198-
LL | | }
199-
| |_________^
162+
LL | baz().await
163+
| ^^^^^
200164

201165
error: this `MutexGuard` is held across an `await` point
202166
--> $DIR/await_holding_lock.rs:185:9
@@ -206,15 +170,10 @@ LL | let mut guard = x.lock().unwrap();
206170
|
207171
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await
208172
note: these are all the `await` points this lock is held through
209-
--> $DIR/await_holding_lock.rs:185:5
210-
|
211-
LL | / let mut guard = x.lock().unwrap();
212-
LL | |
213-
LL | | *guard += 1;
214-
LL | | drop(guard);
215-
LL | | baz().await;
216-
LL | | }
217-
| |_^
173+
--> $DIR/await_holding_lock.rs:189:11
174+
|
175+
LL | baz().await;
176+
| ^^^^^
218177

219178
error: aborting due to 13 previous errors
220179

src/tools/clippy/tests/ui/await_holding_refcell_ref.stderr

Lines changed: 23 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@ LL | let b = x.borrow();
66
|
77
= help: ensure the reference is dropped before calling `await`
88
note: these are all the `await` points this reference is held through
9-
--> $DIR/await_holding_refcell_ref.rs:6:5
9+
--> $DIR/await_holding_refcell_ref.rs:8:11
1010
|
11-
LL | / let b = x.borrow();
12-
LL | |
13-
LL | | baz().await
14-
LL | | }
15-
| |_^
11+
LL | baz().await
12+
| ^^^^^
1613
= note: `-D clippy::await-holding-refcell-ref` implied by `-D warnings`
1714
= help: to override `-D warnings` add `#[allow(clippy::await_holding_refcell_ref)]`
1815

@@ -24,13 +21,10 @@ LL | let b = x.borrow_mut();
2421
|
2522
= help: ensure the reference is dropped before calling `await`
2623
note: these are all the `await` points this reference is held through
27-
--> $DIR/await_holding_refcell_ref.rs:12:5
24+
--> $DIR/await_holding_refcell_ref.rs:14:11
2825
|
29-
LL | / let b = x.borrow_mut();
30-
LL | |
31-
LL | | baz().await
32-
LL | | }
33-
| |_^
26+
LL | baz().await
27+
| ^^^^^
3428

3529
error: this `RefCell` reference is held across an `await` point
3630
--> $DIR/await_holding_refcell_ref.rs:34:9
@@ -40,16 +34,13 @@ LL | let b = x.borrow_mut();
4034
|
4135
= help: ensure the reference is dropped before calling `await`
4236
note: these are all the `await` points this reference is held through
43-
--> $DIR/await_holding_refcell_ref.rs:34:5
44-
|
45-
LL | / let b = x.borrow_mut();
46-
LL | |
47-
LL | |
48-
LL | | let second = baz().await;
49-
... |
50-
LL | | first + second + third
51-
LL | | }
52-
| |_^
37+
--> $DIR/await_holding_refcell_ref.rs:37:24
38+
|
39+
LL | let second = baz().await;
40+
| ^^^^^
41+
LL |
42+
LL | let third = baz().await;
43+
| ^^^^^
5344

5445
error: this `RefCell` reference is held across an `await` point
5546
--> $DIR/await_holding_refcell_ref.rs:47:9
@@ -59,16 +50,10 @@ LL | let b = x.borrow_mut();
5950
|
6051
= help: ensure the reference is dropped before calling `await`
6152
note: these are all the `await` points this reference is held through
62-
--> $DIR/await_holding_refcell_ref.rs:47:5
63-
|
64-
LL | / let b = x.borrow_mut();
65-
LL | |
66-
LL | |
67-
LL | | let second = baz().await;
68-
... |
69-
LL | | first + second + third
70-
LL | | }
71-
| |_^
53+
--> $DIR/await_holding_refcell_ref.rs:50:24
54+
|
55+
LL | let second = baz().await;
56+
| ^^^^^
7257

7358
error: this `RefCell` reference is held across an `await` point
7459
--> $DIR/await_holding_refcell_ref.rs:63:13
@@ -78,13 +63,10 @@ LL | let b = x.borrow_mut();
7863
|
7964
= help: ensure the reference is dropped before calling `await`
8065
note: these are all the `await` points this reference is held through
81-
--> $DIR/await_holding_refcell_ref.rs:63:9
66+
--> $DIR/await_holding_refcell_ref.rs:65:15
8267
|
83-
LL | / let b = x.borrow_mut();
84-
LL | |
85-
LL | | baz().await
86-
LL | | };
87-
| |_____^
68+
LL | baz().await
69+
| ^^^^^
8870

8971
error: this `RefCell` reference is held across an `await` point
9072
--> $DIR/await_holding_refcell_ref.rs:76:13
@@ -94,13 +76,10 @@ LL | let b = x.borrow_mut();
9476
|
9577
= help: ensure the reference is dropped before calling `await`
9678
note: these are all the `await` points this reference is held through
97-
--> $DIR/await_holding_refcell_ref.rs:76:9
79+
--> $DIR/await_holding_refcell_ref.rs:78:15
9880
|
99-
LL | / let b = x.borrow_mut();
100-
LL | |
101-
LL | | baz().await
102-
LL | | }
103-
| |_____^
81+
LL | baz().await
82+
| ^^^^^
10483

10584
error: aborting due to 6 previous errors
10685

src/tools/clippy/tests/ui/future_not_send.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ where
5959
{
6060
let rt = &t;
6161
async { true }.await;
62+
let _ = rt;
6263
t
6364
}
6465

0 commit comments

Comments
 (0)