diff options
| author | Lily Mara <lilymara@onesignal.com> | 2022-04-18 11:16:35 -0700 |
|---|---|---|
| committer | Lily Mara <lilymara@onesignal.com> | 2022-04-18 11:16:35 -0700 |
| commit | 7e26edce65df4e89be23aa22bcb3d3a2db723bf7 (patch) | |
| tree | 35a87ce875fd6218a37f7038ef2b6e84b8e33335 | |
| parent | a511072c2cb29f4a30fbd357c7e4b6771b9f6a29 (diff) | |
| download | rust-7e26edce65df4e89be23aa22bcb3d3a2db723bf7.tar.gz rust-7e26edce65df4e89be23aa22bcb3d3a2db723bf7.zip | |
fixup! Add `await_holding_invalid_type` lint
| -rw-r--r-- | clippy_lints/src/await_holding_invalid.rs | 5 | ||||
| -rw-r--r-- | tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.stderr | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/clippy_lints/src/await_holding_invalid.rs b/clippy_lints/src/await_holding_invalid.rs index 5659651c842..022f82ebf51 100644 --- a/clippy_lints/src/await_holding_invalid.rs +++ b/clippy_lints/src/await_holding_invalid.rs @@ -146,15 +146,20 @@ declare_clippy_lint! { /// /// ```toml /// await-holding-invalid-types = [ + /// # You can specify a type name /// "CustomLockType", + /// # You can (optionally) specify a reason + /// { type = "OtherCustomLockType", reason = "Relies on a thread local" } /// ] /// ``` /// /// ```rust /// # async fn baz() {} /// struct CustomLockType; + /// struct OtherCustomLockType; /// async fn foo() { /// let _x = CustomLockType; + /// let _y = CustomLockType; /// baz().await; // Lint violation /// } /// ``` diff --git a/tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.stderr b/tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.stderr index eebdd624d24..62c45b54634 100644 --- a/tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.stderr +++ b/tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.stderr @@ -1,25 +1,25 @@ -error: `std::string::String` may not be held across an `await` point according to config +error: `std::string::String` may not be held across an `await` point per `clippy.toml` --> $DIR/await_holding_invalid_type.rs:5:9 | LL | let _x = String::from("hello"); | ^^ | = note: `-D clippy::await-holding-invalid-type` implied by `-D warnings` - = note: strings are bad (according to clippy.toml) + = note: strings are bad -error: `std::net::Ipv4Addr` may not be held across an `await` point according to config +error: `std::net::Ipv4Addr` may not be held across an `await` point per `clippy.toml` --> $DIR/await_holding_invalid_type.rs:10:9 | LL | let _x = Ipv4Addr::new(127, 0, 0, 1); | ^^ -error: `std::string::String` may not be held across an `await` point according to config +error: `std::string::String` may not be held across an `await` point per `clippy.toml` --> $DIR/await_holding_invalid_type.rs:31:13 | LL | let _x = String::from("hi!"); | ^^ | - = note: strings are bad (according to clippy.toml) + = note: strings are bad error: aborting due to 3 previous errors |
