Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: pin-init: replace clippy `expect` with `allow`

`clippy` has changed behavior in [1] (Rust 1.95) where it no longer
warns about the `let_and_return` lint when a comment is placed between
the let binding and the return expression. Nightly thus fails to build,
because the expectation is no longer fulfilled.

Thus replace the expectation with an `allow`.

[ The errors were:

error: this lint expectation is unfulfilled
--> rust/pin-init/src/lib.rs:1279:10
|
1279 | #[expect(clippy::let_and_return)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D unfulfilled-lint-expectations` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(unfulfilled_lint_expectations)]`

error: this lint expectation is unfulfilled
--> rust/pin-init/src/lib.rs:1295:10
|
1295 | #[expect(clippy::let_and_return)]
| ^^^^^^^^^^^^^^^^^^^^^^

- Miguel ]

Link: https://github.com/rust-lang/rust-clippy/pull/16461 [1]
Signed-off-by: Benno Lossin <lossin@kernel.org>
Cc: stable@vger.kernel.org # Needed in 6.18.y and later.
Link: https://patch.msgid.link/20260215132232.1549861-1-lossin@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Benno Lossin and committed by
Miguel Ojeda
a58b8764 621609f1

+2 -2
+2 -2
rust/pin-init/src/lib.rs
··· 1276 1276 /// 1277 1277 /// - `*mut U` must be castable to `*mut T` and any value of type `T` written through such a 1278 1278 /// pointer must result in a valid `U`. 1279 - #[expect(clippy::let_and_return)] 1280 1279 pub const unsafe fn cast_pin_init<T, U, E>(init: impl PinInit<T, E>) -> impl PinInit<U, E> { 1281 1280 // SAFETY: initialization delegated to a valid initializer. Cast is valid by function safety 1282 1281 // requirements. 1283 1282 let res = unsafe { pin_init_from_closure(|ptr: *mut U| init.__pinned_init(ptr.cast::<T>())) }; 1284 1283 // FIXME: remove the let statement once the nightly-MSRV allows it (1.78 otherwise encounters a 1285 1284 // cycle when computing the type returned by this function) 1285 + #[allow(clippy::let_and_return)] 1286 1286 res 1287 1287 } 1288 1288 ··· 1292 1292 /// 1293 1293 /// - `*mut U` must be castable to `*mut T` and any value of type `T` written through such a 1294 1294 /// pointer must result in a valid `U`. 1295 - #[expect(clippy::let_and_return)] 1296 1295 pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> { 1297 1296 // SAFETY: initialization delegated to a valid initializer. Cast is valid by function safety 1298 1297 // requirements. 1299 1298 let res = unsafe { init_from_closure(|ptr: *mut U| init.__init(ptr.cast::<T>())) }; 1300 1299 // FIXME: remove the let statement once the nightly-MSRV allows it (1.78 otherwise encounters a 1301 1300 // cycle when computing the type returned by this function) 1301 + #[allow(clippy::let_and_return)] 1302 1302 res 1303 1303 } 1304 1304