rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rust: list: remove nonexistent insert_at() from the comments
@ 2025-08-02 21:00 Zhi Wang
  2025-08-02 21:31 ` Miguel Ojeda
  0 siblings, 1 reply; 3+ messages in thread
From: Zhi Wang @ 2025-08-02 21:00 UTC (permalink / raw)
  To: ojeda, alex.gaynor
  Cc: boqun.feng, gary, bjorn3_gh, lossin, a.hindborg, aliceryhl,
	tmgross, dakr, rust-for-linux, linux-kernel, Zhi Wang

The insert_at() method was never introduced in the code. Remove it from
the comments to avoid confusion.

No functional change intended.

Fixes: 52ae96f5187c ("rust: list: make the cursor point between elements")
Signed-off-by: Zhi Wang <zhiw@nvidia.com>
---
 rust/kernel/list.rs | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/rust/kernel/list.rs b/rust/kernel/list.rs
index 44e5219cfcbc..f40eaa17a8fc 100644
--- a/rust/kernel/list.rs
+++ b/rust/kernel/list.rs
@@ -761,19 +761,6 @@ fn next(&mut self) -> Option<ArcBorrow<'a, T>> {
 ///     out
 /// }
 ///
-/// // Use a cursor to insert a value at a specific index. Returns an error if the index is out of
-/// // bounds.
-/// fn insert_at(list: &mut List<ListItem>, new: ListArc<ListItem>, idx: usize) -> Result {
-///     let mut cursor = list.cursor_front();
-///     for _ in 0..idx {
-///         if !cursor.move_next() {
-///             return Err(EINVAL);
-///         }
-///     }
-///     cursor.insert_next(new);
-///     Ok(())
-/// }
-///
 /// // Merge two sorted lists into a single sorted list.
 /// fn merge_sorted(list: &mut List<ListItem>, merge: List<ListItem>) {
 ///     let mut cursor = list.cursor_front();
@@ -799,8 +786,6 @@ fn next(&mut self) -> Option<ArcBorrow<'a, T>> {
 /// // [14, 10, 15, 14]
 /// assert!(remove_first(&mut list, 14).is_some());
 /// // [10, 15, 14]
-/// insert_at(&mut list, ListItem::new(12)?, 2)?;
-/// // [10, 15, 12, 14]
 /// assert!(remove_last(&mut list, 15).is_some());
 /// // [10, 12, 14]
 ///
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rust: list: remove nonexistent insert_at() from the comments
  2025-08-02 21:00 [PATCH] rust: list: remove nonexistent insert_at() from the comments Zhi Wang
@ 2025-08-02 21:31 ` Miguel Ojeda
  2025-08-03  6:42   ` Zhi Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Miguel Ojeda @ 2025-08-02 21:31 UTC (permalink / raw)
  To: Zhi Wang
  Cc: ojeda, alex.gaynor, boqun.feng, gary, bjorn3_gh, lossin,
	a.hindborg, aliceryhl, tmgross, dakr, rust-for-linux,
	linux-kernel

On Sat, Aug 2, 2025 at 11:00 PM Zhi Wang <zhiw@nvidia.com> wrote:
>
> The insert_at() method was never introduced in the code. Remove it from
> the comments to avoid confusion.

Hmm... I am not sure what you mean -- `insert_at()` is an example
function, used in the example itself.

Why would we remove that one, and not the others in the example, e.g.
`remove_all`?

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rust: list: remove nonexistent insert_at() from the comments
  2025-08-02 21:31 ` Miguel Ojeda
@ 2025-08-03  6:42   ` Zhi Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Zhi Wang @ 2025-08-03  6:42 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: ojeda, alex.gaynor, boqun.feng, gary, bjorn3_gh, lossin,
	a.hindborg, aliceryhl, tmgross, dakr, rust-for-linux,
	linux-kernel

On Sat, 2 Aug 2025 23:31:10 +0200
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote:

> On Sat, Aug 2, 2025 at 11:00 PM Zhi Wang <zhiw@nvidia.com> wrote:
> >
> > The insert_at() method was never introduced in the code. Remove it
> > from the comments to avoid confusion.
> 
> Hmm... I am not sure what you mean -- `insert_at()` is an example
> function, used in the example itself.
> 
> Why would we remove that one, and not the others in the example, e.g.
> `remove_all`?
> 

Oh, you are right, I lost the context when reading the code and
hacking the list routines at late night.

Please drop this.

> Cheers,
> Miguel
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-03  6:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-02 21:00 [PATCH] rust: list: remove nonexistent insert_at() from the comments Zhi Wang
2025-08-02 21:31 ` Miguel Ojeda
2025-08-03  6:42   ` Zhi Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).