Resolve clippy::needless_lifetimes

error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
      --> src/range_map.rs:66:5
       |
    66 |     pub fn iter<'a>(&'a self, offset: Size, len: Size) -> impl Iterator<Item = (Size, &'a T)> + 'a {
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = note: `-D clippy::needless-lifetimes` implied by `-D clippy::all`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes

    error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
      --> src/range_map.rs:86:5
       |
    86 |     pub fn iter_mut_all<'a>(&'a mut self) -> impl Iterator<Item = &'a mut T> + 'a {
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes

    error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
       --> src/range_map.rs:122:5
        |
    122 | /     pub fn iter_mut<'a>(
    123 | |         &'a mut self,
    124 | |         offset: Size,
    125 | |         len: Size,
    126 | |     ) -> impl Iterator<Item = (Size, &'a mut T)> + 'a
        | |_____________________________________________________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes

    error: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
        --> src/shims/intrinsics.rs:1391:1
         |
    1391 | fn simd_element_to_bool<'tcx>(elem: ImmTy<'tcx, Tag>) -> InterpResult<'tcx, bool> {
         | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
This commit is contained in:
David Tolnay 2022-04-29 15:43:36 -07:00
parent 2ca7f3b45d
commit c6bd81bbf3
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82

View file

@ -63,7 +63,7 @@ impl<T> RangeMap<T> {
/// through interior mutability.
///
/// The iterator also provides the offset of the given element.
pub fn iter<'a>(&'a self, offset: Size, len: Size) -> impl Iterator<Item = (Size, &'a T)> + 'a {
pub fn iter(&self, offset: Size, len: Size) -> impl Iterator<Item = (Size, &T)> {
let offset = offset.bytes();
let len = len.bytes();
// Compute a slice starting with the elements we care about.
@ -83,7 +83,7 @@ impl<T> RangeMap<T> {
.map(|elem| (Size::from_bytes(elem.range.start), &elem.data))
}
pub fn iter_mut_all<'a>(&'a mut self) -> impl Iterator<Item = &'a mut T> + 'a {
pub fn iter_mut_all(&mut self) -> impl Iterator<Item = &mut T> {
self.v.iter_mut().map(|elem| &mut elem.data)
}
@ -119,11 +119,7 @@ impl<T> RangeMap<T> {
/// Moreover, this will opportunistically merge neighbouring equal blocks.
///
/// The iterator also provides the offset of the given element.
pub fn iter_mut<'a>(
&'a mut self,
offset: Size,
len: Size,
) -> impl Iterator<Item = (Size, &'a mut T)> + 'a
pub fn iter_mut(&mut self, offset: Size, len: Size) -> impl Iterator<Item = (Size, &mut T)>
where
T: Clone + PartialEq,
{