Skip to content
Myr

Resolve mut_mut pedantic clippy lint

Before adoption: this commit came in with the history the project adopted, so no landing records it.

warning: borrow of a mutable reference --> serde_core/src/de/impls.rs:1054:32 | 1054 | $clear(&mut self.0); | ^^^^^ ... 1076 | / seq_impl!( 1077 | | #[cfg(any(feature = "std", feature = "alloc"))] 1078 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] 1079 | | BinaryHeap<T: Ord>, ... | 1084 | | BinaryHeap::push 1085 | | ); | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut = note: `-W clippy::mut-mut` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::mut_mut)]` = note: this warning originates in the macro `seq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: reborrow instead | 1054 | $clear(&mut *self.0); | + warning: borrow of a mutable reference --> serde_core/src/de/impls.rs:1055:34 | 1055 | $reserve(&mut self.0, size_hint::cautious::<T>($access.size_hint())); | ^^^^^ ... 1076 | / seq_impl!( 1077 | | #[cfg(any(feature = "std", feature = "alloc"))] 1078 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] 1079 | | BinaryHeap<T: Ord>, ... | 1084 | | BinaryHeap::push 1085 | | ); | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut = note: this warning originates in the macro `seq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: reborrow instead | 1055 | $reserve(&mut *self.0, size_hint::cautious::<T>($access.size_hint())); | + warning: borrow of a mutable reference --> serde_core/src/de/impls.rs:1059:37 | 1059 | $insert(&mut self.0, value); | ^^^^^ ... 1076 | / seq_impl!( 1077 | | #[cfg(any(feature = "std", feature = "alloc"))] 1078 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] 1079 | | BinaryHeap<T: Ord>, ... | 1084 | | BinaryHeap::push 1085 | | ); | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut = note: this warning originates in the macro `seq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: reborrow instead | 1059 | $insert(&mut *self.0, value); | + warning: borrow of a mutable reference --> serde_core/src/de/impls.rs:1054:32 | 1054 | $clear(&mut self.0); | ^^^^^ ... 1087 | / seq_impl!( 1088 | | #[cfg(any(feature = "std", feature = "alloc"))] 1089 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] 1090 | | BTreeSet<T: Eq + Ord>, ... | 1095 | | BTreeSet::insert 1096 | | ); | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut = note: this warning originates in the macro `seq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: reborrow instead | 1054 | $clear(&mut *self.0); | + warning: borrow of a mutable reference --> serde_core/src/de/impls.rs:1055:34 | 1055 | $reserve(&mut self.0, size_hint::cautious::<T>($access.size_hint())); | ^^^^^ ... 1087 | / seq_impl!( 1088 | | #[cfg(any(feature = "std", feature = "alloc"))] 1089 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] 1090 | | BTreeSet<T: Eq + Ord>, ... | 1095 | | BTreeSet::insert 1096 | | ); | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut = note: this warning originates in the macro `seq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: reborrow instead | 1055 | $reserve(&mut *self.0, size_hint::cautious::<T>($access.size_hint())); | + warning: borrow of a mutable reference --> serde_core/src/de/impls.rs:1059:37 | 1059 | $insert(&mut self.0, value); | ^^^^^ ... 1087 | / seq_impl!( 1088 | | #[cfg(any(feature = "std", feature = "alloc"))] 1089 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] 1090 | | BTreeSet<T: Eq + Ord>, ... | 1095 | | BTreeSet::insert 1096 | | ); | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut = note: this warning originates in the macro `seq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: reborrow instead | 1059 | $insert(&mut *self.0, value); | + warning: borrow of a mutable reference --> serde_core/src/de/impls.rs:1054:32 | 1054 | $clear(&mut self.0); | ^^^^^ ... 1098 | / seq_impl!( 1099 | | #[cfg(any(feature = "std", feature = "alloc"))] 1100 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] 1101 | | LinkedList<T>, ... | 1106 | | LinkedList::push_back 1107 | | ); | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut = note: this warning originates in the macro `seq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: reborrow instead | 1054 | $clear(&mut *self.0); | + warning: borrow of a mutable reference --> serde_core/src/de/impls.rs:1055:34 | 1055 | $reserve(&mut self.0, size_hint::cautious::<T>($access.size_hint())); | ^^^^^ ... 1098 | / seq_impl!( 1099 | | #[cfg(any(feature = "std", feature = "alloc"))] 1100 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] 1101 | | LinkedList<T>, ... | 1106 | | LinkedList::push_back 1107 | | ); | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut = note: this warning originates in the macro `seq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: reborrow instead | 1055 | $reserve(&mut *self.0, size_hint::cautious::<T>($access.size_hint())); | + warning: borrow of a mutable reference --> serde_core/src/de/impls.rs:1059:37 | 1059 | $insert(&mut self.0, value); | ^^^^^ ... 1098 | / seq_impl!( 1099 | | #[cfg(any(feature = "std", feature = "alloc"))] 1100 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] 1101 | | LinkedList<T>, ... | 1106 | | LinkedList::push_back 1107 | | ); | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut = note: this warning originates in the macro `seq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: reborrow instead | 1059 | $insert(&mut *self.0, value); | + warning: borrow of a mutable reference --> serde_core/src/de/impls.rs:1054:32 | 1054 | $clear(&mut self.0); | ^^^^^ ... 1109 | / seq_impl!( 1110 | | #[cfg(feature = "std")] 1111 | | #[cfg_attr(docsrs, doc(cfg(feature = "std")))] 1112 | | HashSet<T: Eq + Hash, S: BuildHasher + Default>, ... | 1117 | | HashSet::insert 1118 | | ); | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut = note: this warning originates in the macro `seq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: reborrow instead | 1054 | $clear(&mut *self.0); | + warning: borrow of a mutable reference --> serde_core/src/de/impls.rs:1055:34 | 1055 | $reserve(&mut self.0, size_hint::cautious::<T>($access.size_hint())); | ^^^^^ ... 1109 | / seq_impl!( 1110 | | #[cfg(feature = "std")] 1111 | | #[cfg_attr(docsrs, doc(cfg(feature = "std")))] 1112 | | HashSet<T: Eq + Hash, S: BuildHasher + Default>, ... | 1117 | | HashSet::insert 1118 | | ); | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut = note: this warning originates in the macro `seq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: reborrow instead | 1055 | $reserve(&mut *self.0, size_hint::cautious::<T>($access.size_hint())); | + warning: borrow of a mutable reference --> serde_core/src/de/impls.rs:1059:37 | 1059 | $insert(&mut self.0, value); | ^^^^^ ... 1109 | / seq_impl!( 1110 | | #[cfg(feature = "std")] 1111 | | #[cfg_attr(docsrs, doc(cfg(feature = "std")))] 1112 | | HashSet<T: Eq + Hash, S: BuildHasher + Default>, ... | 1117 | | HashSet::insert 1118 | | ); | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut = note: this warning originates in the macro `seq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: reborrow instead | 1059 | $insert(&mut *self.0, value); | + warning: borrow of a mutable reference --> serde_core/src/de/impls.rs:1054:32 | 1054 | $clear(&mut self.0); | ^^^^^ ... 1120 | / seq_impl!( 1121 | | #[cfg(any(feature = "std", feature = "alloc"))] 1122 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] 1123 | | VecDeque<T>, ... | 1128 | | VecDeque::push_back 1129 | | ); | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut = note: this warning originates in the macro `seq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: reborrow instead | 1054 | $clear(&mut *self.0); | + warning: borrow of a mutable reference --> serde_core/src/de/impls.rs:1055:34 | 1055 | $reserve(&mut self.0, size_hint::cautious::<T>($access.size_hint())); | ^^^^^ ... 1120 | / seq_impl!( 1121 | | #[cfg(any(feature = "std", feature = "alloc"))] 1122 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] 1123 | | VecDeque<T>, ... | 1128 | | VecDeque::push_back 1129 | | ); | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut = note: this warning originates in the macro `seq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: reborrow instead | 1055 | $reserve(&mut *self.0, size_hint::cautious::<T>($access.size_hint())); | + warning: borrow of a mutable reference --> serde_core/src/de/impls.rs:1059:37 | 1059 | $insert(&mut self.0, value); | ^^^^^ ... 1120 | / seq_impl!( 1121 | | #[cfg(any(feature = "std", feature = "alloc"))] 1122 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] 1123 | | VecDeque<T>, ... | 1128 | | VecDeque::push_back 1129 | | ); | |_- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut = note: this warning originates in the macro `seq_impl` (in Nightly builds, run with -Z macro-backtrace for more info) help: reborrow instead | 1059 | $insert(&mut *self.0, value); | +

authored by David Tolnay · committed by David Tolnay · parent 1023d07 · Browse files · 1 file+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−4 removed

  • other:+4 added−4 removed

1 file+4 added−4 removed

modified:serde_core/src/de/impls.rs+4 added-4 removed
1045 unmodified lines
1046 formatter.write_str("a sequence")1047 }10481049 #[inline]1050 fn visit_seq<A>(mut self, mut $access: A) -> Result<Self::Value, A::Error>1050 fn visit_seq<A>(self, mut $access: A) -> Result<Self::Value, A::Error>1051 where1052 A: SeqAccess<'de>,1053 {1054 $clear(&mut self.0);1055 $reserve(&mut self.0, size_hint::cautious::<T>($access.size_hint()));1054 $clear(&mut *self.0);1055 $reserve(&mut *self.0, size_hint::cautious::<T>($access.size_hint()));10561057 // FIXME: try to overwrite old values here? (Vec, VecDeque, LinkedList)1058 while let Some(value) = tri!($access.next_element()) {1059 $insert(&mut self.0, value);1059 $insert(&mut *self.0, value);1060 }10611062 Ok(())1063 }
2110 unmodified lines