Skip to contentSkip to conversation

rust: str: use the "kernel vertical" imports style

PATCH Applied Miguel Ojeda 4 participants 6 messages Jun 9

Subsystems (2)
lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 1/2 rust: str: use the "kernel vertical" imports style

Format the Rust prelude to use the "kernel vertical" imports style [1].

No functional changes intended.

---
 rust/kernel/str.rs | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
rust/kernel/str.rs +19 -5
index a435674f05ea..4eae05e4baf9 100644
@@ -3,14 +3,28 @@
 //! String representations.
 
 use crate::{
-    alloc::{flags::*, AllocError, KVec},
-    error::{to_result, Result},
-    fmt::{self, Write},
-    prelude::*,
+    alloc::{
+        flags::*,
+        AllocError,
+        KVec, //
+    },
+    error::{
+        to_result,
+        Result, //
+    },
+    fmt::{
+        self,
+        Write, //
+    },
+    prelude::*, //
 };
 use core::{
     marker::PhantomData,
-    ops::{Deref, DerefMut, Index},
+    ops::{
+        Deref,
+        DerefMut,
+        Index, //
+    }, //
 };
 
 pub use crate::prelude::CStr;
Signature · 1 line
2.54.0
author maintainer
#1 lore raw

PATCH 2/2 rust: str: clean unused import for Rust >= 1.98

Starting with Rust 1.98.0 (expected 2026-08-20), the compiler has changed how the resolution algorithm works [1][2] in upstream commit c4d84db5f184 ("Resolver: Batched import resolution."), and it now spots:

    error: unused import: `flags::*`
     --> rust/kernel/str.rs:7:9
      |
    7 |         flags::*,
      |         ^^^^^^^^
      |
      = note: `-D unused-imports` implied by `-D warnings`
      = help: to override `-D warnings` add `#[allow(unused_imports)]`

It happens to not be needed because the prelude::* already provides the flags.

Thus clean it up.

Cc [email protected] # Needed in 6.18.y and later (prelude added to `str`).
---
 rust/kernel/str.rs | 1 -
 1 file changed, 1 deletion(-)
rust/kernel/str.rs +0 -1
index 4eae05e4baf9..b3caa9a1c898 100644
@@ -4,7 +4,6 @@
 
 use crate::{
     alloc::{
-        flags::*,
         AllocError,
         KVec, //
     },
Signature · 1 line
2.54.0
reviewer Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] rust: str: clean unused import for Rust >= 1.98

Quoted 14 lines · Miguel Ojeda

Starting with Rust 1.98.0 (expected 2026-08-20), the compiler has changed how the resolution algorithm works [1][2] in upstream commit c4d84db5f184 ("Resolver: Batched import resolution."), and it now spots:

    error: unused import: `flags::*`
     --> rust/kernel/str.rs:7:9
      |
    7 |         flags::*,
      |         ^^^^^^^^
      |
      = note: `-D unused-imports` implied by `-D warnings`
      = help: to override `-D warnings` add `#[allow(unused_imports)]`
Quoted 8 lines

It happens to not be needed because the prelude::* already provides the flags.

Thus clean it up.

Cc [email protected] # Needed in 6.18.y and later (prelude added to `str`).

I ran into this one too.

reviewer Reviewed-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] rust: str: clean unused import for Rust >= 1.98

In reply to Miguel Ojeda
Quoted 13 lines · Miguel Ojeda

Starting with Rust 1.98.0 (expected 2026-08-20), the compiler has changed how the resolution algorithm works [1][2] in upstream commit c4d84db5f184 ("Resolver: Batched import resolution."), and it now spots:

    error: unused import: `flags::*`
     --> rust/kernel/str.rs:7:9
      |
    7 |         flags::*,
      |         ^^^^^^^^
      |
      = note: `-D unused-imports` implied by `-D warnings`
      = help: to override `-D warnings` add `#[allow(unused_imports)]`
Quoted 8 lines

It happens to not be needed because the prelude::* already provides the flags.

Thus clean it up.

Cc [email protected] # Needed in 6.18.y and later (prelude added to `str`).
Quoted 3 lines
---
 rust/kernel/str.rs | 1 -
 1 file changed, 1 deletion(-)
reviewer Reviewed-by on v1 1/2
#4 lore raw
In reply to Miguel Ojeda
Quoted 6 lines · Miguel Ojeda

Format the Rust prelude to use the "kernel vertical" imports style [1].

No functional changes intended.

Quoted 3 lines
---
 rust/kernel/str.rs | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
Applied
#5 lore raw
In reply to Miguel Ojeda
Quoted 7 lines · Miguel Ojeda

Format the Rust prelude to use the "kernel vertical" imports style [1].

No functional changes intended.

Applied series to rust-next since the second is a "fix" for nightly I would like to have in linux-next -- thanks everyone!

I fixed the description here (and made it match with the other two Andreas' patches I picked), and removed a spurious "[2]" in the second one.

Cheers,
Miguel