Auto merge of #12984 - bitfield:fix_doc_nits_c, r=Alexendoo

Fix doc nits

More tender love and polish for the documentation and suggestion texts: adding formatting, links, full stops, tweaking wording for readability, changing 'which' to 'that' where appropriate, and other standard copyediting changes.

changelog: Docs [ `await_holding_lock` ]: fix doc nits
changelog: Docs [ `await_holding_refcell_ref` ]: fix doc nits
changelog: Docs [ `await_holding_invalid_type` ]: fix doc nits
changelog: Docs [ `cast_precision_loss` ]: fix doc nits
changelog: Docs [ `cast_sign_loss` ]: fix doc nits
changelog: Docs [ `cast_possible_truncation` ]: fix doc nits
changelog: Docs [ `cast_possible_wrap` ]: fix doc nits
changelog: Docs [ `cast_lossless` ]: fix doc nits
changelog: Docs [ `unnecessary_cast` ]: fix doc nits
changelog: Docs [ `cast_ptr_alignment` ]: fix doc nits
changelog: Docs [ `fn_to_numeric_cast` ]: fix doc nits
changelog: Docs [ `fn_to_numeric_cast_with_truncation` ]: fix doc nits
changelog: Docs [ `fn_to_numeric_cast_any` ]: fix doc nits
changelog: Docs [ `char_lit_as_u8` ]: fix doc nits
changelog: Docs [ `ptr_as_ptr` ]: fix doc nits
changelog: Docs [ `ptr_cast_constness` ]: fix doc nits
changelog: Docs [ `as_ptr_cast_mut` ]: fix doc nits
changelog: Docs [ `little_endian_bytes` ]: fix doc nits
changelog: Docs [ `big_endian_bytes` ]: fix doc nits
changelog: Docs [ `bind_instead_of_map` ]: fix doc nits
changelog: Docs [ `same_name_method` ]: fix doc nits
This commit is contained in:
bors 2024-07-10 17:55:08 +00:00
commit 8d3b1f9e30
13 changed files with 197 additions and 191 deletions

View File

@ -11,21 +11,25 @@ use rustc_span::{sym, Span};
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for calls to await while holding a non-async-aware MutexGuard. /// Checks for calls to `await` while holding a non-async-aware
/// `MutexGuard`.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// The Mutex types found in std::sync and parking_lot /// The Mutex types found in [`std::sync`][https://doc.rust-lang.org/stable/std/sync/] and
/// are not designed to operate in an async context across await points. /// [`parking_lot`](https://docs.rs/parking_lot/latest/parking_lot/) are
/// not designed to operate in an async context across await points.
/// ///
/// There are two potential solutions. One is to use an async-aware Mutex /// There are two potential solutions. One is to use an async-aware `Mutex`
/// type. Many asynchronous foundation crates provide such a Mutex type. The /// type. Many asynchronous foundation crates provide such a `Mutex` type.
/// other solution is to ensure the mutex is unlocked before calling await, /// The other solution is to ensure the mutex is unlocked before calling
/// either by introducing a scope or an explicit call to Drop::drop. /// `await`, either by introducing a scope or an explicit call to
/// [`Drop::drop`](https://doc.rust-lang.org/std/ops/trait.Drop.html).
/// ///
/// ### Known problems /// ### Known problems
/// Will report false positive for explicitly dropped guards /// Will report false positive for explicitly dropped guards
/// ([#6446](https://github.com/rust-lang/rust-clippy/issues/6446)). A workaround for this is /// ([#6446](https://github.com/rust-lang/rust-clippy/issues/6446)). A
/// to wrap the `.lock()` call in a block instead of explicitly dropping the guard. /// workaround for this is to wrap the `.lock()` call in a block instead of
/// explicitly dropping the guard.
/// ///
/// ### Example /// ### Example
/// ```no_run /// ```no_run
@ -73,11 +77,11 @@ declare_clippy_lint! {
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for calls to await while holding a `RefCell` `Ref` or `RefMut`. /// Checks for calls to `await` while holding a `RefCell`, `Ref`, or `RefMut`.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// `RefCell` refs only check for exclusive mutable access /// `RefCell` refs only check for exclusive mutable access
/// at runtime. Holding onto a `RefCell` ref across an `await` suspension point /// at runtime. Holding a `RefCell` ref across an await suspension point
/// risks panics from a mutable ref shared while other refs are outstanding. /// risks panics from a mutable ref shared while other refs are outstanding.
/// ///
/// ### Known problems /// ### Known problems
@ -131,13 +135,13 @@ declare_clippy_lint! {
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Allows users to configure types which should not be held across `await` /// Allows users to configure types which should not be held across await
/// suspension points. /// suspension points.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// There are some types which are perfectly "safe" to be used concurrently /// There are some types which are perfectly safe to use concurrently from
/// from a memory access perspective but will cause bugs at runtime if they /// a memory access perspective, but that will cause bugs at runtime if
/// are held in such a way. /// they are held in such a way.
/// ///
/// ### Example /// ### Example
/// ///
@ -228,15 +232,15 @@ impl AwaitHolding {
cx, cx,
AWAIT_HOLDING_LOCK, AWAIT_HOLDING_LOCK,
ty_cause.source_info.span, ty_cause.source_info.span,
"this `MutexGuard` is held across an `await` point", "this `MutexGuard` is held across an await point",
|diag| { |diag| {
diag.help( diag.help(
"consider using an async-aware `Mutex` type or ensuring the \ "consider using an async-aware `Mutex` type or ensuring the \
`MutexGuard` is dropped before calling await", `MutexGuard` is dropped before calling `await`",
); );
diag.span_note( diag.span_note(
await_points(), await_points(),
"these are all the `await` points this lock is held through", "these are all the await points this lock is held through",
); );
}, },
); );
@ -245,12 +249,12 @@ impl AwaitHolding {
cx, cx,
AWAIT_HOLDING_REFCELL_REF, AWAIT_HOLDING_REFCELL_REF,
ty_cause.source_info.span, ty_cause.source_info.span,
"this `RefCell` reference is held across an `await` point", "this `RefCell` reference is held across an await point",
|diag| { |diag| {
diag.help("ensure the reference is dropped before calling `await`"); diag.help("ensure the reference is dropped before calling `await`");
diag.span_note( diag.span_note(
await_points(), await_points(),
"these are all the `await` points this reference is held through", "these are all the await points this reference is held through",
); );
}, },
); );
@ -268,7 +272,7 @@ fn emit_invalid_type(cx: &LateContext<'_>, span: Span, disallowed: &DisallowedPa
AWAIT_HOLDING_INVALID_TYPE, AWAIT_HOLDING_INVALID_TYPE,
span, span,
format!( format!(
"`{}` may not be held across an `await` point per `clippy.toml`", "`{}` may not be held across an await point per `clippy.toml`",
disallowed.path() disallowed.path()
), ),
|diag| { |diag| {

View File

@ -32,7 +32,7 @@ use rustc_session::impl_lint_pass;
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for casts from any numerical to a float type where /// Checks for casts from any numeric type to a float type where
/// the receiving type cannot store all values from the original type without /// the receiving type cannot store all values from the original type without
/// rounding errors. This possible rounding is to be expected, so this lint is /// rounding errors. This possible rounding is to be expected, so this lint is
/// `Allow` by default. /// `Allow` by default.
@ -58,14 +58,14 @@ declare_clippy_lint! {
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for casts from a signed to an unsigned numerical /// Checks for casts from a signed to an unsigned numeric
/// type. In this case, negative values wrap around to large positive values, /// type. In this case, negative values wrap around to large positive values,
/// which can be quite surprising in practice. However, as the cast works as /// which can be quite surprising in practice. However, since the cast works as
/// defined, this lint is `Allow` by default. /// defined, this lint is `Allow` by default.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// Possibly surprising results. You can activate this lint /// Possibly surprising results. You can activate this lint
/// as a one-time check to see where numerical wrapping can arise. /// as a one-time check to see where numeric wrapping can arise.
/// ///
/// ### Example /// ### Example
/// ```no_run /// ```no_run
@ -80,7 +80,7 @@ declare_clippy_lint! {
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for casts between numerical types that may /// Checks for casts between numeric types that may
/// truncate large values. This is expected behavior, so the cast is `Allow` by /// truncate large values. This is expected behavior, so the cast is `Allow` by
/// default. It suggests user either explicitly ignore the lint, /// default. It suggests user either explicitly ignore the lint,
/// or use `try_from()` and handle the truncation, default, or panic explicitly. /// or use `try_from()` and handle the truncation, default, or panic explicitly.
@ -120,17 +120,16 @@ declare_clippy_lint! {
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for casts from an unsigned type to a signed type of /// Checks for casts from an unsigned type to a signed type of
/// the same size, or possibly smaller due to target dependent integers. /// the same size, or possibly smaller due to target-dependent integers.
/// Performing such a cast is a 'no-op' for the compiler, i.e., nothing is /// Performing such a cast is a no-op for the compiler (that is, nothing is
/// changed at the bit level, and the binary representation of the value is /// changed at the bit level), and the binary representation of the value is
/// reinterpreted. This can cause wrapping if the value is too big /// reinterpreted. This can cause wrapping if the value is too big
/// for the target signed type. However, the cast works as defined, so this lint /// for the target signed type. However, the cast works as defined, so this lint
/// is `Allow` by default. /// is `Allow` by default.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// While such a cast is not bad in itself, the results can /// While such a cast is not bad in itself, the results can
/// be surprising when this is not the intended behavior, as demonstrated by the /// be surprising when this is not the intended behavior:
/// example below.
/// ///
/// ### Example /// ### Example
/// ```no_run /// ```no_run
@ -144,16 +143,16 @@ declare_clippy_lint! {
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for casts between numerical types that may /// Checks for casts between numeric types that can be replaced by safe
/// be replaced by safe conversion functions. /// conversion functions.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// Rust's `as` keyword will perform many kinds of /// Rust's `as` keyword will perform many kinds of conversions, including
/// conversions, including silently lossy conversions. Conversion functions such /// silently lossy conversions. Conversion functions such as `i32::from`
/// as `i32::from` will only perform lossless conversions. Using the conversion /// will only perform lossless conversions. Using the conversion functions
/// functions prevents conversions from turning into silent lossy conversions if /// prevents conversions from becoming silently lossy if the input types
/// the types of the input expressions ever change, and make it easier for /// ever change, and makes it clear for people reading the code that the
/// people reading the code to know that the conversion is lossless. /// conversion is lossless.
/// ///
/// ### Example /// ### Example
/// ```no_run /// ```no_run
@ -177,19 +176,21 @@ declare_clippy_lint! {
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for casts to the same type, casts of int literals to integer types, casts of float /// Checks for casts to the same type, casts of int literals to integer
/// literals to float types and casts between raw pointers without changing type or constness. /// types, casts of float literals to float types, and casts between raw
/// pointers that don't change type or constness.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// It's just unnecessary. /// It's just unnecessary.
/// ///
/// ### Known problems /// ### Known problems
/// When the expression on the left is a function call, the lint considers the return type to be /// When the expression on the left is a function call, the lint considers
/// a type alias if it's aliased through a `use` statement /// the return type to be a type alias if it's aliased through a `use`
/// (like `use std::io::Result as IoResult`). It will not lint such cases. /// statement (like `use std::io::Result as IoResult`). It will not lint
/// such cases.
/// ///
/// This check is also rather primitive. It will only work on primitive types without any /// This check will only work on primitive types without any intermediate
/// intermediate references, raw pointers and trait objects may or may not work. /// references: raw pointers and trait objects may or may not work.
/// ///
/// ### Example /// ### Example
/// ```no_run /// ```no_run
@ -211,17 +212,17 @@ declare_clippy_lint! {
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for casts, using `as` or `pointer::cast`, /// Checks for casts, using `as` or `pointer::cast`, from a
/// from a less-strictly-aligned pointer to a more-strictly-aligned pointer /// less strictly aligned pointer to a more strictly aligned pointer.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// Dereferencing the resulting pointer may be undefined /// Dereferencing the resulting pointer may be undefined behavior.
/// behavior.
/// ///
/// ### Known problems /// ### Known problems
/// Using `std::ptr::read_unaligned` and `std::ptr::write_unaligned` or similar /// Using [`std::ptr::read_unaligned`](https://doc.rust-lang.org/std/ptr/fn.read_unaligned.html) and [`std::ptr::write_unaligned`](https://doc.rust-lang.org/std/ptr/fn.write_unaligned.html) or
/// on the resulting pointer is fine. Is over-zealous: Casts with manual alignment checks or casts like /// similar on the resulting pointer is fine. Is over-zealous: casts with
/// u64-> u8 -> u16 can be fine. Miri is able to do a more in-depth analysis. /// manual alignment checks or casts like `u64` -> `u8` -> `u16` can be
/// fine. Miri is able to do a more in-depth analysis.
/// ///
/// ### Example /// ### Example
/// ```no_run /// ```no_run
@ -234,20 +235,21 @@ declare_clippy_lint! {
#[clippy::version = "pre 1.29.0"] #[clippy::version = "pre 1.29.0"]
pub CAST_PTR_ALIGNMENT, pub CAST_PTR_ALIGNMENT,
pedantic, pedantic,
"cast from a pointer to a more-strictly-aligned pointer" "cast from a pointer to a more strictly aligned pointer"
} }
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for casts of function pointers to something other than usize /// Checks for casts of function pointers to something other than `usize`.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// Casting a function pointer to anything other than usize/isize is not portable across /// Casting a function pointer to anything other than `usize`/`isize` is
/// architectures, because you end up losing bits if the target type is too small or end up with a /// not portable across architectures. If the target type is too small the
/// bunch of extra bits that waste space and add more instructions to the final binary than /// address would be truncated, and target types larger than `usize` are
/// strictly necessary for the problem /// unnecessary.
/// ///
/// Casting to isize also doesn't make sense since there are no signed addresses. /// Casting to `isize` also doesn't make sense, since addresses are never
/// signed.
/// ///
/// ### Example /// ### Example
/// ```no_run /// ```no_run
@ -263,17 +265,17 @@ declare_clippy_lint! {
#[clippy::version = "pre 1.29.0"] #[clippy::version = "pre 1.29.0"]
pub FN_TO_NUMERIC_CAST, pub FN_TO_NUMERIC_CAST,
style, style,
"casting a function pointer to a numeric type other than usize" "casting a function pointer to a numeric type other than `usize`"
} }
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for casts of a function pointer to a numeric type not wide enough to /// Checks for casts of a function pointer to a numeric type not wide enough to
/// store address. /// store an address.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// Such a cast discards some bits of the function's address. If this is intended, it would be more /// Such a cast discards some bits of the function's address. If this is intended, it would be more
/// clearly expressed by casting to usize first, then casting the usize to the intended type (with /// clearly expressed by casting to `usize` first, then casting the `usize` to the intended type (with
/// a comment) to perform the truncation. /// a comment) to perform the truncation.
/// ///
/// ### Example /// ### Example
@ -306,7 +308,7 @@ declare_clippy_lint! {
/// ### Why restrict this? /// ### Why restrict this?
/// Casting a function pointer to an integer can have surprising results and can occur /// Casting a function pointer to an integer can have surprising results and can occur
/// accidentally if parentheses are omitted from a function call. If you aren't doing anything /// accidentally if parentheses are omitted from a function call. If you aren't doing anything
/// low-level with function pointers then you can opt-out of casting functions to integers in /// low-level with function pointers then you can opt out of casting functions to integers in
/// order to avoid mistakes. Alternatively, you can use this lint to audit all uses of function /// order to avoid mistakes. Alternatively, you can use this lint to audit all uses of function
/// pointer casts in your code. /// pointer casts in your code.
/// ///
@ -349,8 +351,8 @@ declare_clippy_lint! {
/// ### Why is this bad? /// ### Why is this bad?
/// In general, casting values to smaller types is /// In general, casting values to smaller types is
/// error-prone and should be avoided where possible. In the particular case of /// error-prone and should be avoided where possible. In the particular case of
/// converting a character literal to u8, it is easy to avoid by just using a /// converting a character literal to `u8`, it is easy to avoid by just using a
/// byte literal instead. As an added bonus, `b'a'` is even slightly shorter /// byte literal instead. As an added bonus, `b'a'` is also slightly shorter
/// than `'a' as u8`. /// than `'a' as u8`.
/// ///
/// ### Example /// ### Example
@ -371,12 +373,13 @@ declare_clippy_lint! {
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for `as` casts between raw pointers without changing its mutability, /// Checks for `as` casts between raw pointers that don't change their
/// namely `*const T` to `*const U` and `*mut T` to `*mut U`. /// constness, namely `*const T` to `*const U` and `*mut T` to `*mut U`.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// Though `as` casts between raw pointers are not terrible, `pointer::cast` is safer because /// Though `as` casts between raw pointers are not terrible,
/// it cannot accidentally change the pointer's mutability nor cast the pointer to other types like `usize`. /// `pointer::cast` is safer because it cannot accidentally change the
/// pointer's mutability, nor cast the pointer to other types like `usize`.
/// ///
/// ### Example /// ### Example
/// ```no_run /// ```no_run
@ -395,12 +398,12 @@ declare_clippy_lint! {
#[clippy::version = "1.51.0"] #[clippy::version = "1.51.0"]
pub PTR_AS_PTR, pub PTR_AS_PTR,
pedantic, pedantic,
"casting using `as` from and to raw pointers that doesn't change its mutability, where `pointer::cast` could take the place of `as`" "casting using `as` between raw pointers that doesn't change their constness, where `pointer::cast` could take the place of `as`"
} }
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for `as` casts between raw pointers which change its constness, namely `*const T` to /// Checks for `as` casts between raw pointers that change their constness, namely `*const T` to
/// `*mut T` and `*mut T` to `*const T`. /// `*mut T` and `*mut T` to `*const T`.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
@ -423,12 +426,12 @@ declare_clippy_lint! {
#[clippy::version = "1.72.0"] #[clippy::version = "1.72.0"]
pub PTR_CAST_CONSTNESS, pub PTR_CAST_CONSTNESS,
pedantic, pedantic,
"casting using `as` from and to raw pointers to change constness when specialized methods apply" "casting using `as` on raw pointers to change constness when specialized methods apply"
} }
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for casts from an enum type to an integral type which will definitely truncate the /// Checks for casts from an enum type to an integral type that will definitely truncate the
/// value. /// value.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
@ -442,7 +445,7 @@ declare_clippy_lint! {
#[clippy::version = "1.61.0"] #[clippy::version = "1.61.0"]
pub CAST_ENUM_TRUNCATION, pub CAST_ENUM_TRUNCATION,
suspicious, suspicious,
"casts from an enum type to an integral type which will truncate the value" "casts from an enum type to an integral type that will truncate the value"
} }
declare_clippy_lint! { declare_clippy_lint! {
@ -621,7 +624,7 @@ declare_clippy_lint! {
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for the result of a `&self`-taking `as_ptr` being cast to a mutable pointer /// Checks for the result of a `&self`-taking `as_ptr` being cast to a mutable pointer.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// Since `as_ptr` takes a `&self`, the pointer won't have write permissions unless interior /// Since `as_ptr` takes a `&self`, the pointer won't have write permissions unless interior

View File

@ -92,7 +92,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, msrv: &Msrv) {
cx, cx,
PTR_AS_PTR, PTR_AS_PTR,
expr.span, expr.span,
"`as` casting between raw pointers without changing its mutability", "`as` casting between raw pointers without changing their constness",
help, help,
final_suggestion, final_suggestion,
app, app,

View File

@ -33,7 +33,7 @@ declare_clippy_lint! {
/// Checks for the usage of the `to_le_bytes` method and/or the function `from_le_bytes`. /// Checks for the usage of the `to_le_bytes` method and/or the function `from_le_bytes`.
/// ///
/// ### Why restrict this? /// ### Why restrict this?
/// To ensure use of big endian or the targets endianness rather than little endian. /// To ensure use of big-endian or the targets endianness rather than little-endian.
/// ///
/// ### Example /// ### Example
/// ```rust,ignore /// ```rust,ignore
@ -51,7 +51,7 @@ declare_clippy_lint! {
/// Checks for the usage of the `to_be_bytes` method and/or the function `from_be_bytes`. /// Checks for the usage of the `to_be_bytes` method and/or the function `from_be_bytes`.
/// ///
/// ### Why restrict this? /// ### Why restrict this?
/// To ensure use of little endian or the targets endianness rather than big endian. /// To ensure use of little-endian or the targets endianness rather than big-endian.
/// ///
/// ### Example /// ### Example
/// ```rust,ignore /// ```rust,ignore

View File

@ -628,12 +628,11 @@ declare_clippy_lint! {
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// Checks for usage of `_.and_then(|x| Some(y))`, `_.and_then(|x| Ok(y))` or /// Checks for usage of `_.and_then(|x| Some(y))`, `_.and_then(|x| Ok(y))`
/// `_.or_else(|x| Err(y))`. /// or `_.or_else(|x| Err(y))`.
/// ///
/// ### Why is this bad? /// ### Why is this bad?
/// Readability, this can be written more concisely as /// This can be written more concisely as `_.map(|x| y)` or `_.map_err(|x| y)`.
/// `_.map(|x| y)` or `_.map_err(|x| y)`.
/// ///
/// ### Example /// ### Example
/// ```no_run /// ```no_run

View File

@ -12,7 +12,7 @@ use std::collections::{BTreeMap, BTreeSet};
declare_clippy_lint! { declare_clippy_lint! {
/// ### What it does /// ### What it does
/// It lints if a struct has two methods with the same name: /// It lints if a struct has two methods with the same name:
/// one from a trait, another not from trait. /// one from a trait, another not from a trait.
/// ///
/// ### Why restrict this? /// ### Why restrict this?
/// Confusing. /// Confusing.

View File

@ -1,4 +1,4 @@
error: `std::string::String` may not be held across an `await` point per `clippy.toml` error: `std::string::String` may not be held across an await point per `clippy.toml`
--> tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.rs:5:9 --> tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.rs:5:9
| |
LL | let _x = String::from("hello"); LL | let _x = String::from("hello");
@ -8,13 +8,13 @@ LL | let _x = String::from("hello");
= note: `-D clippy::await-holding-invalid-type` implied by `-D warnings` = note: `-D clippy::await-holding-invalid-type` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::await_holding_invalid_type)]` = help: to override `-D warnings` add `#[allow(clippy::await_holding_invalid_type)]`
error: `std::net::Ipv4Addr` may not be held across an `await` point per `clippy.toml` error: `std::net::Ipv4Addr` may not be held across an await point per `clippy.toml`
--> tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.rs:10:9 --> tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.rs:10:9
| |
LL | let x = Ipv4Addr::new(127, 0, 0, 1); LL | let x = Ipv4Addr::new(127, 0, 0, 1);
| ^ | ^
error: `std::string::String` may not be held across an `await` point per `clippy.toml` error: `std::string::String` may not be held across an await point per `clippy.toml`
--> tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.rs:33:13 --> tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.rs:33:13
| |
LL | let _x = String::from("hi!"); LL | let _x = String::from("hi!");

View File

@ -8,7 +8,7 @@ mod std_mutex {
pub async fn bad(x: &Mutex<u32>) -> u32 { pub async fn bad(x: &Mutex<u32>) -> u32 {
let guard = x.lock().unwrap(); let guard = x.lock().unwrap();
//~^ ERROR: this `MutexGuard` is held across an `await` point //~^ ERROR: this `MutexGuard` is held across an await point
baz().await baz().await
} }
@ -24,13 +24,13 @@ mod std_mutex {
pub async fn bad_rw(x: &RwLock<u32>) -> u32 { pub async fn bad_rw(x: &RwLock<u32>) -> u32 {
let guard = x.read().unwrap(); let guard = x.read().unwrap();
//~^ ERROR: this `MutexGuard` is held across an `await` point //~^ ERROR: this `MutexGuard` is held across an await point
baz().await baz().await
} }
pub async fn bad_rw_write(x: &RwLock<u32>) -> u32 { pub async fn bad_rw_write(x: &RwLock<u32>) -> u32 {
let mut guard = x.write().unwrap(); let mut guard = x.write().unwrap();
//~^ ERROR: this `MutexGuard` is held across an `await` point //~^ ERROR: this `MutexGuard` is held across an await point
baz().await baz().await
} }
@ -52,7 +52,7 @@ mod std_mutex {
let first = baz().await; let first = baz().await;
let guard = x.lock().unwrap(); let guard = x.lock().unwrap();
//~^ ERROR: this `MutexGuard` is held across an `await` point //~^ ERROR: this `MutexGuard` is held across an await point
let second = baz().await; let second = baz().await;
@ -66,7 +66,7 @@ mod std_mutex {
let second = { let second = {
let guard = x.lock().unwrap(); let guard = x.lock().unwrap();
//~^ ERROR: this `MutexGuard` is held across an `await` point //~^ ERROR: this `MutexGuard` is held across an await point
baz().await baz().await
}; };
@ -79,7 +79,7 @@ mod std_mutex {
pub fn block_bad(x: &Mutex<u32>) -> impl std::future::Future<Output = u32> + '_ { pub fn block_bad(x: &Mutex<u32>) -> impl std::future::Future<Output = u32> + '_ {
async move { async move {
let guard = x.lock().unwrap(); let guard = x.lock().unwrap();
//~^ ERROR: this `MutexGuard` is held across an `await` point //~^ ERROR: this `MutexGuard` is held across an await point
baz().await baz().await
} }
} }
@ -92,7 +92,7 @@ mod parking_lot_mutex {
pub async fn bad(x: &Mutex<u32>) -> u32 { pub async fn bad(x: &Mutex<u32>) -> u32 {
let guard = x.lock(); let guard = x.lock();
//~^ ERROR: this `MutexGuard` is held across an `await` point //~^ ERROR: this `MutexGuard` is held across an await point
baz().await baz().await
} }
@ -108,13 +108,13 @@ mod parking_lot_mutex {
pub async fn bad_rw(x: &RwLock<u32>) -> u32 { pub async fn bad_rw(x: &RwLock<u32>) -> u32 {
let guard = x.read(); let guard = x.read();
//~^ ERROR: this `MutexGuard` is held across an `await` point //~^ ERROR: this `MutexGuard` is held across an await point
baz().await baz().await
} }
pub async fn bad_rw_write(x: &RwLock<u32>) -> u32 { pub async fn bad_rw_write(x: &RwLock<u32>) -> u32 {
let mut guard = x.write(); let mut guard = x.write();
//~^ ERROR: this `MutexGuard` is held across an `await` point //~^ ERROR: this `MutexGuard` is held across an await point
baz().await baz().await
} }
@ -136,7 +136,7 @@ mod parking_lot_mutex {
let first = baz().await; let first = baz().await;
let guard = x.lock(); let guard = x.lock();
//~^ ERROR: this `MutexGuard` is held across an `await` point //~^ ERROR: this `MutexGuard` is held across an await point
let second = baz().await; let second = baz().await;
@ -150,7 +150,7 @@ mod parking_lot_mutex {
let second = { let second = {
let guard = x.lock(); let guard = x.lock();
//~^ ERROR: this `MutexGuard` is held across an `await` point //~^ ERROR: this `MutexGuard` is held across an await point
baz().await baz().await
}; };
@ -163,7 +163,7 @@ mod parking_lot_mutex {
pub fn block_bad(x: &Mutex<u32>) -> impl std::future::Future<Output = u32> + '_ { pub fn block_bad(x: &Mutex<u32>) -> impl std::future::Future<Output = u32> + '_ {
async move { async move {
let guard = x.lock(); let guard = x.lock();
//~^ ERROR: this `MutexGuard` is held across an `await` point //~^ ERROR: this `MutexGuard` is held across an await point
baz().await baz().await
} }
} }
@ -184,7 +184,7 @@ async fn no_await(x: std::sync::Mutex<u32>) {
// `*guard += 1` is removed it is picked up. // `*guard += 1` is removed it is picked up.
async fn dropped_before_await(x: std::sync::Mutex<u32>) { async fn dropped_before_await(x: std::sync::Mutex<u32>) {
let mut guard = x.lock().unwrap(); let mut guard = x.lock().unwrap();
//~^ ERROR: this `MutexGuard` is held across an `await` point //~^ ERROR: this `MutexGuard` is held across an await point
*guard += 1; *guard += 1;
drop(guard); drop(guard);
baz().await; baz().await;

View File

@ -1,11 +1,11 @@
error: this `MutexGuard` is held across an `await` point error: this `MutexGuard` is held across an await point
--> tests/ui/await_holding_lock.rs:10:13 --> tests/ui/await_holding_lock.rs:10:13
| |
LL | let guard = x.lock().unwrap(); LL | let guard = x.lock().unwrap();
| ^^^^^ | ^^^^^
| |
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling `await`
note: these are all the `await` points this lock is held through note: these are all the await points this lock is held through
--> tests/ui/await_holding_lock.rs:12:15 --> tests/ui/await_holding_lock.rs:12:15
| |
LL | baz().await LL | baz().await
@ -13,40 +13,40 @@ LL | baz().await
= note: `-D clippy::await-holding-lock` implied by `-D warnings` = note: `-D clippy::await-holding-lock` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::await_holding_lock)]` = help: to override `-D warnings` add `#[allow(clippy::await_holding_lock)]`
error: this `MutexGuard` is held across an `await` point error: this `MutexGuard` is held across an await point
--> tests/ui/await_holding_lock.rs:26:13 --> tests/ui/await_holding_lock.rs:26:13
| |
LL | let guard = x.read().unwrap(); LL | let guard = x.read().unwrap();
| ^^^^^ | ^^^^^
| |
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling `await`
note: these are all the `await` points this lock is held through note: these are all the await points this lock is held through
--> tests/ui/await_holding_lock.rs:28:15 --> tests/ui/await_holding_lock.rs:28:15
| |
LL | baz().await LL | baz().await
| ^^^^^ | ^^^^^
error: this `MutexGuard` is held across an `await` point error: this `MutexGuard` is held across an await point
--> tests/ui/await_holding_lock.rs:32:13 --> tests/ui/await_holding_lock.rs:32:13
| |
LL | let mut guard = x.write().unwrap(); LL | let mut guard = x.write().unwrap();
| ^^^^^^^^^ | ^^^^^^^^^
| |
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling `await`
note: these are all the `await` points this lock is held through note: these are all the await points this lock is held through
--> tests/ui/await_holding_lock.rs:34:15 --> tests/ui/await_holding_lock.rs:34:15
| |
LL | baz().await LL | baz().await
| ^^^^^ | ^^^^^
error: this `MutexGuard` is held across an `await` point error: this `MutexGuard` is held across an await point
--> tests/ui/await_holding_lock.rs:54:13 --> tests/ui/await_holding_lock.rs:54:13
| |
LL | let guard = x.lock().unwrap(); LL | let guard = x.lock().unwrap();
| ^^^^^ | ^^^^^
| |
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling `await`
note: these are all the `await` points this lock is held through note: these are all the await points this lock is held through
--> tests/ui/await_holding_lock.rs:57:28 --> tests/ui/await_holding_lock.rs:57:28
| |
LL | let second = baz().await; LL | let second = baz().await;
@ -55,79 +55,79 @@ LL |
LL | let third = baz().await; LL | let third = baz().await;
| ^^^^^ | ^^^^^
error: this `MutexGuard` is held across an `await` point error: this `MutexGuard` is held across an await point
--> tests/ui/await_holding_lock.rs:68:17 --> tests/ui/await_holding_lock.rs:68:17
| |
LL | let guard = x.lock().unwrap(); LL | let guard = x.lock().unwrap();
| ^^^^^ | ^^^^^
| |
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling `await`
note: these are all the `await` points this lock is held through note: these are all the await points this lock is held through
--> tests/ui/await_holding_lock.rs:70:19 --> tests/ui/await_holding_lock.rs:70:19
| |
LL | baz().await LL | baz().await
| ^^^^^ | ^^^^^
error: this `MutexGuard` is held across an `await` point error: this `MutexGuard` is held across an await point
--> tests/ui/await_holding_lock.rs:81:17 --> tests/ui/await_holding_lock.rs:81:17
| |
LL | let guard = x.lock().unwrap(); LL | let guard = x.lock().unwrap();
| ^^^^^ | ^^^^^
| |
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling `await`
note: these are all the `await` points this lock is held through note: these are all the await points this lock is held through
--> tests/ui/await_holding_lock.rs:83:19 --> tests/ui/await_holding_lock.rs:83:19
| |
LL | baz().await LL | baz().await
| ^^^^^ | ^^^^^
error: this `MutexGuard` is held across an `await` point error: this `MutexGuard` is held across an await point
--> tests/ui/await_holding_lock.rs:94:13 --> tests/ui/await_holding_lock.rs:94:13
| |
LL | let guard = x.lock(); LL | let guard = x.lock();
| ^^^^^ | ^^^^^
| |
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling `await`
note: these are all the `await` points this lock is held through note: these are all the await points this lock is held through
--> tests/ui/await_holding_lock.rs:96:15 --> tests/ui/await_holding_lock.rs:96:15
| |
LL | baz().await LL | baz().await
| ^^^^^ | ^^^^^
error: this `MutexGuard` is held across an `await` point error: this `MutexGuard` is held across an await point
--> tests/ui/await_holding_lock.rs:110:13 --> tests/ui/await_holding_lock.rs:110:13
| |
LL | let guard = x.read(); LL | let guard = x.read();
| ^^^^^ | ^^^^^
| |
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling `await`
note: these are all the `await` points this lock is held through note: these are all the await points this lock is held through
--> tests/ui/await_holding_lock.rs:112:15 --> tests/ui/await_holding_lock.rs:112:15
| |
LL | baz().await LL | baz().await
| ^^^^^ | ^^^^^
error: this `MutexGuard` is held across an `await` point error: this `MutexGuard` is held across an await point
--> tests/ui/await_holding_lock.rs:116:13 --> tests/ui/await_holding_lock.rs:116:13
| |
LL | let mut guard = x.write(); LL | let mut guard = x.write();
| ^^^^^^^^^ | ^^^^^^^^^
| |
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling `await`
note: these are all the `await` points this lock is held through note: these are all the await points this lock is held through
--> tests/ui/await_holding_lock.rs:118:15 --> tests/ui/await_holding_lock.rs:118:15
| |
LL | baz().await LL | baz().await
| ^^^^^ | ^^^^^
error: this `MutexGuard` is held across an `await` point error: this `MutexGuard` is held across an await point
--> tests/ui/await_holding_lock.rs:138:13 --> tests/ui/await_holding_lock.rs:138:13
| |
LL | let guard = x.lock(); LL | let guard = x.lock();
| ^^^^^ | ^^^^^
| |
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling `await`
note: these are all the `await` points this lock is held through note: these are all the await points this lock is held through
--> tests/ui/await_holding_lock.rs:141:28 --> tests/ui/await_holding_lock.rs:141:28
| |
LL | let second = baz().await; LL | let second = baz().await;
@ -136,40 +136,40 @@ LL |
LL | let third = baz().await; LL | let third = baz().await;
| ^^^^^ | ^^^^^
error: this `MutexGuard` is held across an `await` point error: this `MutexGuard` is held across an await point
--> tests/ui/await_holding_lock.rs:152:17 --> tests/ui/await_holding_lock.rs:152:17
| |
LL | let guard = x.lock(); LL | let guard = x.lock();
| ^^^^^ | ^^^^^
| |
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling `await`
note: these are all the `await` points this lock is held through note: these are all the await points this lock is held through
--> tests/ui/await_holding_lock.rs:154:19 --> tests/ui/await_holding_lock.rs:154:19
| |
LL | baz().await LL | baz().await
| ^^^^^ | ^^^^^
error: this `MutexGuard` is held across an `await` point error: this `MutexGuard` is held across an await point
--> tests/ui/await_holding_lock.rs:165:17 --> tests/ui/await_holding_lock.rs:165:17
| |
LL | let guard = x.lock(); LL | let guard = x.lock();
| ^^^^^ | ^^^^^
| |
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling `await`
note: these are all the `await` points this lock is held through note: these are all the await points this lock is held through
--> tests/ui/await_holding_lock.rs:167:19 --> tests/ui/await_holding_lock.rs:167:19
| |
LL | baz().await LL | baz().await
| ^^^^^ | ^^^^^
error: this `MutexGuard` is held across an `await` point error: this `MutexGuard` is held across an await point
--> tests/ui/await_holding_lock.rs:186:9 --> tests/ui/await_holding_lock.rs:186:9
| |
LL | let mut guard = x.lock().unwrap(); LL | let mut guard = x.lock().unwrap();
| ^^^^^^^^^ | ^^^^^^^^^
| |
= help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling await = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling `await`
note: these are all the `await` points this lock is held through note: these are all the await points this lock is held through
--> tests/ui/await_holding_lock.rs:190:11 --> tests/ui/await_holding_lock.rs:190:11
| |
LL | baz().await; LL | baz().await;

View File

@ -4,13 +4,13 @@ use std::cell::RefCell;
async fn bad(x: &RefCell<u32>) -> u32 { async fn bad(x: &RefCell<u32>) -> u32 {
let b = x.borrow(); let b = x.borrow();
//~^ ERROR: this `RefCell` reference is held across an `await` point //~^ ERROR: this `RefCell` reference is held across an await point
baz().await baz().await
} }
async fn bad_mut(x: &RefCell<u32>) -> u32 { async fn bad_mut(x: &RefCell<u32>) -> u32 {
let b = x.borrow_mut(); let b = x.borrow_mut();
//~^ ERROR: this `RefCell` reference is held across an `await` point //~^ ERROR: this `RefCell` reference is held across an await point
baz().await baz().await
} }
@ -32,7 +32,7 @@ async fn also_bad(x: &RefCell<u32>) -> u32 {
let first = baz().await; let first = baz().await;
let b = x.borrow_mut(); let b = x.borrow_mut();
//~^ ERROR: this `RefCell` reference is held across an `await` point //~^ ERROR: this `RefCell` reference is held across an await point
let second = baz().await; let second = baz().await;
@ -45,7 +45,7 @@ async fn less_bad(x: &RefCell<u32>) -> u32 {
let first = baz().await; let first = baz().await;
let b = x.borrow_mut(); let b = x.borrow_mut();
//~^ ERROR: this `RefCell` reference is held across an `await` point //~^ ERROR: this `RefCell` reference is held across an await point
let second = baz().await; let second = baz().await;
@ -61,7 +61,7 @@ async fn not_good(x: &RefCell<u32>) -> u32 {
let second = { let second = {
let b = x.borrow_mut(); let b = x.borrow_mut();
//~^ ERROR: this `RefCell` reference is held across an `await` point //~^ ERROR: this `RefCell` reference is held across an await point
baz().await baz().await
}; };
@ -74,7 +74,7 @@ async fn not_good(x: &RefCell<u32>) -> u32 {
fn block_bad(x: &RefCell<u32>) -> impl std::future::Future<Output = u32> + '_ { fn block_bad(x: &RefCell<u32>) -> impl std::future::Future<Output = u32> + '_ {
async move { async move {
let b = x.borrow_mut(); let b = x.borrow_mut();
//~^ ERROR: this `RefCell` reference is held across an `await` point //~^ ERROR: this `RefCell` reference is held across an await point
baz().await baz().await
} }
} }

View File

@ -1,11 +1,11 @@
error: this `RefCell` reference is held across an `await` point error: this `RefCell` reference is held across an await point
--> tests/ui/await_holding_refcell_ref.rs:6:9 --> tests/ui/await_holding_refcell_ref.rs:6:9
| |
LL | let b = x.borrow(); LL | let b = x.borrow();
| ^ | ^
| |
= help: ensure the reference is dropped before calling `await` = help: ensure the reference is dropped before calling `await`
note: these are all the `await` points this reference is held through note: these are all the await points this reference is held through
--> tests/ui/await_holding_refcell_ref.rs:8:11 --> tests/ui/await_holding_refcell_ref.rs:8:11
| |
LL | baz().await LL | baz().await
@ -13,27 +13,27 @@ LL | baz().await
= note: `-D clippy::await-holding-refcell-ref` implied by `-D warnings` = note: `-D clippy::await-holding-refcell-ref` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::await_holding_refcell_ref)]` = help: to override `-D warnings` add `#[allow(clippy::await_holding_refcell_ref)]`
error: this `RefCell` reference is held across an `await` point error: this `RefCell` reference is held across an await point
--> tests/ui/await_holding_refcell_ref.rs:12:9 --> tests/ui/await_holding_refcell_ref.rs:12:9
| |
LL | let b = x.borrow_mut(); LL | let b = x.borrow_mut();
| ^ | ^
| |
= help: ensure the reference is dropped before calling `await` = help: ensure the reference is dropped before calling `await`
note: these are all the `await` points this reference is held through note: these are all the await points this reference is held through
--> tests/ui/await_holding_refcell_ref.rs:14:11 --> tests/ui/await_holding_refcell_ref.rs:14:11
| |
LL | baz().await LL | baz().await
| ^^^^^ | ^^^^^
error: this `RefCell` reference is held across an `await` point error: this `RefCell` reference is held across an await point
--> tests/ui/await_holding_refcell_ref.rs:34:9 --> tests/ui/await_holding_refcell_ref.rs:34:9
| |
LL | let b = x.borrow_mut(); LL | let b = x.borrow_mut();
| ^ | ^
| |
= help: ensure the reference is dropped before calling `await` = help: ensure the reference is dropped before calling `await`
note: these are all the `await` points this reference is held through note: these are all the await points this reference is held through
--> tests/ui/await_holding_refcell_ref.rs:37:24 --> tests/ui/await_holding_refcell_ref.rs:37:24
| |
LL | let second = baz().await; LL | let second = baz().await;
@ -42,40 +42,40 @@ LL |
LL | let third = baz().await; LL | let third = baz().await;
| ^^^^^ | ^^^^^
error: this `RefCell` reference is held across an `await` point error: this `RefCell` reference is held across an await point
--> tests/ui/await_holding_refcell_ref.rs:47:9 --> tests/ui/await_holding_refcell_ref.rs:47:9
| |
LL | let b = x.borrow_mut(); LL | let b = x.borrow_mut();
| ^ | ^
| |
= help: ensure the reference is dropped before calling `await` = help: ensure the reference is dropped before calling `await`
note: these are all the `await` points this reference is held through note: these are all the await points this reference is held through
--> tests/ui/await_holding_refcell_ref.rs:50:24 --> tests/ui/await_holding_refcell_ref.rs:50:24
| |
LL | let second = baz().await; LL | let second = baz().await;
| ^^^^^ | ^^^^^
error: this `RefCell` reference is held across an `await` point error: this `RefCell` reference is held across an await point
--> tests/ui/await_holding_refcell_ref.rs:63:13 --> tests/ui/await_holding_refcell_ref.rs:63:13
| |
LL | let b = x.borrow_mut(); LL | let b = x.borrow_mut();
| ^ | ^
| |
= help: ensure the reference is dropped before calling `await` = help: ensure the reference is dropped before calling `await`
note: these are all the `await` points this reference is held through note: these are all the await points this reference is held through
--> tests/ui/await_holding_refcell_ref.rs:65:15 --> tests/ui/await_holding_refcell_ref.rs:65:15
| |
LL | baz().await LL | baz().await
| ^^^^^ | ^^^^^
error: this `RefCell` reference is held across an `await` point error: this `RefCell` reference is held across an await point
--> tests/ui/await_holding_refcell_ref.rs:76:13 --> tests/ui/await_holding_refcell_ref.rs:76:13
| |
LL | let b = x.borrow_mut(); LL | let b = x.borrow_mut();
| ^ | ^
| |
= help: ensure the reference is dropped before calling `await` = help: ensure the reference is dropped before calling `await`
note: these are all the `await` points this reference is held through note: these are all the await points this reference is held through
--> tests/ui/await_holding_refcell_ref.rs:78:15 --> tests/ui/await_holding_refcell_ref.rs:78:15
| |
LL | baz().await LL | baz().await

View File

@ -1,4 +1,4 @@
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/crashes/ice-12616.rs:6:5 --> tests/ui/crashes/ice-12616.rs:6:5
| |
LL | s() as *const (); LL | s() as *const ();

View File

@ -1,4 +1,4 @@
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:18:33 --> tests/ui/ptr_as_ptr.rs:18:33
| |
LL | *unsafe { Box::from_raw(Box::into_raw(Box::new(o)) as *mut super::issue_11278_a::T<String>) } LL | *unsafe { Box::from_raw(Box::into_raw(Box::new(o)) as *mut super::issue_11278_a::T<String>) }
@ -7,37 +7,37 @@ LL | *unsafe { Box::from_raw(Box::into_raw(Box::new(o)) as *mut super::i
= note: `-D clippy::ptr-as-ptr` implied by `-D warnings` = note: `-D clippy::ptr-as-ptr` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::ptr_as_ptr)]` = help: to override `-D warnings` add `#[allow(clippy::ptr_as_ptr)]`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:27:13 --> tests/ui/ptr_as_ptr.rs:27:13
| |
LL | let _ = ptr as *const i32; LL | let _ = ptr as *const i32;
| ^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast::<i32>()` | ^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast::<i32>()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:28:13 --> tests/ui/ptr_as_ptr.rs:28:13
| |
LL | let _ = mut_ptr as *mut i32; LL | let _ = mut_ptr as *mut i32;
| ^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `mut_ptr.cast::<i32>()` | ^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `mut_ptr.cast::<i32>()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:33:17 --> tests/ui/ptr_as_ptr.rs:33:17
| |
LL | let _ = *ptr_ptr as *const i32; LL | let _ = *ptr_ptr as *const i32;
| ^^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `(*ptr_ptr).cast::<i32>()` | ^^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `(*ptr_ptr).cast::<i32>()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:46:25 --> tests/ui/ptr_as_ptr.rs:46:25
| |
LL | let _: *const i32 = ptr as *const _; LL | let _: *const i32 = ptr as *const _;
| ^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast()` | ^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:47:23 --> tests/ui/ptr_as_ptr.rs:47:23
| |
LL | let _: *mut i32 = mut_ptr as _; LL | let _: *mut i32 = mut_ptr as _;
| ^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `mut_ptr.cast()` | ^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `mut_ptr.cast()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:50:21 --> tests/ui/ptr_as_ptr.rs:50:21
| |
LL | let _ = inline!($ptr as *const i32); LL | let _ = inline!($ptr as *const i32);
@ -45,157 +45,157 @@ LL | let _ = inline!($ptr as *const i32);
| |
= note: this error originates in the macro `__inline_mac_fn_main` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `__inline_mac_fn_main` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:71:13 --> tests/ui/ptr_as_ptr.rs:71:13
| |
LL | let _ = ptr as *const i32; LL | let _ = ptr as *const i32;
| ^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast::<i32>()` | ^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast::<i32>()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:72:13 --> tests/ui/ptr_as_ptr.rs:72:13
| |
LL | let _ = mut_ptr as *mut i32; LL | let _ = mut_ptr as *mut i32;
| ^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `mut_ptr.cast::<i32>()` | ^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `mut_ptr.cast::<i32>()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:79:9 --> tests/ui/ptr_as_ptr.rs:79:9
| |
LL | ptr::null_mut() as *mut u32 LL | ptr::null_mut() as *mut u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut::<u32>()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut::<u32>()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:83:9 --> tests/ui/ptr_as_ptr.rs:83:9
| |
LL | std::ptr::null_mut() as *mut u32 LL | std::ptr::null_mut() as *mut u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null_mut::<u32>()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null_mut::<u32>()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:88:9 --> tests/ui/ptr_as_ptr.rs:88:9
| |
LL | ptr::null_mut() as *mut u32 LL | ptr::null_mut() as *mut u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut::<u32>()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut::<u32>()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:92:9 --> tests/ui/ptr_as_ptr.rs:92:9
| |
LL | core::ptr::null_mut() as *mut u32 LL | core::ptr::null_mut() as *mut u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null_mut::<u32>()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null_mut::<u32>()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:97:9 --> tests/ui/ptr_as_ptr.rs:97:9
| |
LL | ptr::null() as *const u32 LL | ptr::null() as *const u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null::<u32>()` | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null::<u32>()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:101:9 --> tests/ui/ptr_as_ptr.rs:101:9
| |
LL | std::ptr::null() as *const u32 LL | std::ptr::null() as *const u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null::<u32>()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null::<u32>()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:106:9 --> tests/ui/ptr_as_ptr.rs:106:9
| |
LL | ptr::null() as *const u32 LL | ptr::null() as *const u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null::<u32>()` | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null::<u32>()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:110:9 --> tests/ui/ptr_as_ptr.rs:110:9
| |
LL | core::ptr::null() as *const u32 LL | core::ptr::null() as *const u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null::<u32>()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null::<u32>()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:117:9 --> tests/ui/ptr_as_ptr.rs:117:9
| |
LL | ptr::null_mut() as *mut _ LL | ptr::null_mut() as *mut _
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut()` | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:121:9 --> tests/ui/ptr_as_ptr.rs:121:9
| |
LL | std::ptr::null_mut() as *mut _ LL | std::ptr::null_mut() as *mut _
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null_mut()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null_mut()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:126:9 --> tests/ui/ptr_as_ptr.rs:126:9
| |
LL | ptr::null_mut() as *mut _ LL | ptr::null_mut() as *mut _
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut()` | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:130:9 --> tests/ui/ptr_as_ptr.rs:130:9
| |
LL | core::ptr::null_mut() as *mut _ LL | core::ptr::null_mut() as *mut _
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null_mut()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null_mut()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:135:9 --> tests/ui/ptr_as_ptr.rs:135:9
| |
LL | ptr::null() as *const _ LL | ptr::null() as *const _
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null()` | ^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:139:9 --> tests/ui/ptr_as_ptr.rs:139:9
| |
LL | std::ptr::null() as *const _ LL | std::ptr::null() as *const _
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:144:9 --> tests/ui/ptr_as_ptr.rs:144:9
| |
LL | ptr::null() as *const _ LL | ptr::null() as *const _
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null()` | ^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:148:9 --> tests/ui/ptr_as_ptr.rs:148:9
| |
LL | core::ptr::null() as *const _ LL | core::ptr::null() as *const _
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:155:9 --> tests/ui/ptr_as_ptr.rs:155:9
| |
LL | ptr::null_mut() as _ LL | ptr::null_mut() as _
| ^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut()` | ^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:159:9 --> tests/ui/ptr_as_ptr.rs:159:9
| |
LL | std::ptr::null_mut() as _ LL | std::ptr::null_mut() as _
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null_mut()` | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null_mut()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:164:9 --> tests/ui/ptr_as_ptr.rs:164:9
| |
LL | ptr::null_mut() as _ LL | ptr::null_mut() as _
| ^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut()` | ^^^^^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null_mut()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:168:9 --> tests/ui/ptr_as_ptr.rs:168:9
| |
LL | core::ptr::null_mut() as _ LL | core::ptr::null_mut() as _
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null_mut()` | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `core::ptr::null_mut()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:173:9 --> tests/ui/ptr_as_ptr.rs:173:9
| |
LL | ptr::null() as _ LL | ptr::null() as _
| ^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null()` | ^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:177:9 --> tests/ui/ptr_as_ptr.rs:177:9
| |
LL | std::ptr::null() as _ LL | std::ptr::null() as _
| ^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null()` | ^^^^^^^^^^^^^^^^^^^^^ help: try call directly: `std::ptr::null()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:182:9 --> tests/ui/ptr_as_ptr.rs:182:9
| |
LL | ptr::null() as _ LL | ptr::null() as _
| ^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null()` | ^^^^^^^^^^^^^^^^ help: try call directly: `ptr::null()`
error: `as` casting between raw pointers without changing its mutability error: `as` casting between raw pointers without changing their constness
--> tests/ui/ptr_as_ptr.rs:186:9 --> tests/ui/ptr_as_ptr.rs:186:9
| |
LL | core::ptr::null() as _ LL | core::ptr::null() as _