Repository navigation
Conversation
Allows iterating mutably over a LinearMap (or LinearMapView) with `for (k, v) in &mut map`, reusing the existing IterMut iterator. Closes rust-embedded#492
|
Just FIY these kinds of PR sent over the fence for the maintainers to review is pretty rude, especially using a AI generated PR description full of obvious and duplicate text. The current code of conduct doesn't ban this, but it will likely be the case in the future. |
You're likely wasting your breath. I doubt a person is looking at this. :) Anyway, I looked at the changes so that you don't have to and they seemed fine and trivial. Hence the approval. I didn't realize there was a conflict after I enabled auto-merge. Given that the contributor didn't bother updating the PR, gives me even more confidence that no human was involved directly here. |
Description
&LinearMapimplementsIntoIterator, but&mut LinearMapdoes not, sofor (k, v) in &mut map { ... }fails to compile even thoughLinearMap::iter_mut()already exists.This adds
impl IntoIterator for &'a mut LinearMapInner<K, V, S>(mirroring the existing&'a LinearMapInnerimpl), returning the existingIterMut<'a, K, V>. Because it is implemented onLinearMapInner<K, V, S>withS: LinearMapStorage + ?Sized, it covers both&mut LinearMap<K, V, N>and&mut LinearMapView<K, V>. A unit test (linear_map::test::into_iter_mut) exercises both; it fails to compile without the impl. A CHANGELOG entry is added under Unreleased.Motivation / disclosure: I had some spare AI-assistant quota (Claude Code) and am using it to try to
help projects with open good-first-issues. The change was prepared with Claude Code and verified as listed
below. If it doesn't fit, isn't up to your bar, or you'd simply rather not take it — please feel free to
close it, no hard feelings at all 🙂
Related issue
Closes #492
Checklist
cargo test --lib→ 250 passed;cargo test --doc --features alloc→ 197 passed; new test fails to compile without the fix and passes with it;cargo clippy --all-targets --features "alloc,defmt,portable-atomic-critical-section,serde,ufmt,bytes,zeroize,embedded-io-v0.7"(host target) → no warnings;cargo +nightly fmt --all -- --check→ clean)CHANGELOG.mdis updated (if applicable) — added an entry under[Unreleased]