Skip to content

Commit 7e26edc

Browse files
fixup! Add await_holding_invalid_type lint
1 parent a511072 commit 7e26edc

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

clippy_lints/src/await_holding_invalid.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,20 @@ declare_clippy_lint! {
146146
///
147147
/// ```toml
148148
/// await-holding-invalid-types = [
149+
/// # You can specify a type name
149150
/// "CustomLockType",
151+
/// # You can (optionally) specify a reason
152+
/// { type = "OtherCustomLockType", reason = "Relies on a thread local" }
150153
/// ]
151154
/// ```
152155
///
153156
/// ```rust
154157
/// # async fn baz() {}
155158
/// struct CustomLockType;
159+
/// struct OtherCustomLockType;
156160
/// async fn foo() {
157161
/// let _x = CustomLockType;
162+
/// let _y = CustomLockType;
158163
/// baz().await; // Lint violation
159164
/// }
160165
/// ```
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
error: `std::string::String` may not be held across an `await` point according to config
1+
error: `std::string::String` may not be held across an `await` point per `clippy.toml`
22
--> $DIR/await_holding_invalid_type.rs:5:9
33
|
44
LL | let _x = String::from("hello");
55
| ^^
66
|
77
= note: `-D clippy::await-holding-invalid-type` implied by `-D warnings`
8-
= note: strings are bad (according to clippy.toml)
8+
= note: strings are bad
99

10-
error: `std::net::Ipv4Addr` may not be held across an `await` point according to config
10+
error: `std::net::Ipv4Addr` may not be held across an `await` point per `clippy.toml`
1111
--> $DIR/await_holding_invalid_type.rs:10:9
1212
|
1313
LL | let _x = Ipv4Addr::new(127, 0, 0, 1);
1414
| ^^
1515

16-
error: `std::string::String` may not be held across an `await` point according to config
16+
error: `std::string::String` may not be held across an `await` point per `clippy.toml`
1717
--> $DIR/await_holding_invalid_type.rs:31:13
1818
|
1919
LL | let _x = String::from("hi!");
2020
| ^^
2121
|
22-
= note: strings are bad (according to clippy.toml)
22+
= note: strings are bad
2323

2424
error: aborting due to 3 previous errors
2525

0 commit comments

Comments
 (0)