Skip to content

Commit

Permalink
elide some lifetimes per clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrensha committed Nov 15, 2024
1 parent 3743526 commit a4184b3
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion capnp/src/any_pointer_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl<'a> From<Builder<'a>> for crate::dynamic_value::Builder<'a> {
}
}

impl<'a> core::fmt::Debug for Reader<'a> {
impl core::fmt::Debug for Reader<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
core::fmt::Debug::fmt(
&::core::convert::Into::<crate::dynamic_value::Reader<'_>>::into(*self),
Expand Down
14 changes: 7 additions & 7 deletions capnp/src/capability_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ where
*self
}
}
impl<'a, T> Copy for Reader<'a, T> where T: FromClientHook {}
impl<T> Copy for Reader<'_, T> where T: FromClientHook {}

impl<'a, T> Reader<'a, T>
where
Expand All @@ -89,7 +89,7 @@ where
}
}

impl<'a, T> Reader<'a, T>
impl<T> Reader<'_, T>
where
T: FromClientHook,
{
Expand All @@ -116,7 +116,7 @@ where
}
}

impl<'a, T> Reader<'a, T>
impl<T> Reader<'_, T>
where
T: FromClientHook,
{
Expand Down Expand Up @@ -145,7 +145,7 @@ where
}
}

impl<'a, T> IndexMove<u32, Result<T>> for Reader<'a, T>
impl<T> IndexMove<u32, Result<T>> for Reader<'_, T>
where
T: FromClientHook,
{
Expand Down Expand Up @@ -190,7 +190,7 @@ where
}
}

impl<'a, T> Builder<'a, T>
impl<T> Builder<'_, T>
where
T: FromClientHook,
{
Expand Down Expand Up @@ -223,7 +223,7 @@ where
}
}

impl<'a, T> Builder<'a, T>
impl<T> Builder<'_, T>
where
T: FromClientHook,
{
Expand Down Expand Up @@ -296,7 +296,7 @@ impl<'a, T: FromClientHook> From<Builder<'a, T>> for crate::dynamic_value::Build
}
}

impl<'a, T: FromClientHook> core::fmt::Debug for Reader<'a, T> {
impl<T: FromClientHook> core::fmt::Debug for Reader<'_, T> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
core::fmt::Debug::fmt(
&::core::convert::Into::<crate::dynamic_value::Reader<'_>>::into(self.reborrow()),
Expand Down
2 changes: 1 addition & 1 deletion capnp/src/data_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ impl<'a> crate::dynamic_value::DowncastBuilder<'a> for Builder<'a> {
}
}

impl<'a> core::fmt::Debug for Reader<'a> {
impl core::fmt::Debug for Reader<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
core::fmt::Debug::fmt(
&::core::convert::Into::<crate::dynamic_value::Reader<'_>>::into(*self),
Expand Down
2 changes: 1 addition & 1 deletion capnp/src/dynamic_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ impl<'a> crate::traits::SetterInput<crate::any_pointer::Owned> for Reader<'a> {
}
}

impl<'a> core::fmt::Debug for Reader<'a> {
impl core::fmt::Debug for Reader<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
core::fmt::Debug::fmt(
&::core::convert::Into::<crate::dynamic_value::Reader<'_>>::into(*self),
Expand Down
2 changes: 1 addition & 1 deletion capnp/src/dynamic_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ impl<'a> crate::traits::SetterInput<crate::any_pointer::Owned> for Reader<'a> {
}
}

impl<'a> core::fmt::Debug for Reader<'a> {
impl core::fmt::Debug for Reader<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
core::fmt::Debug::fmt(
&::core::convert::Into::<crate::dynamic_value::Reader<'_>>::into(*self),
Expand Down
12 changes: 6 additions & 6 deletions capnp/src/enum_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ impl<'a, T: TryFrom<u16, Error = NotInSchema>> FromPointerReader<'a> for Reader<
}
}

impl<'a, T: TryFrom<u16, Error = NotInSchema>>
IndexMove<u32, ::core::result::Result<T, NotInSchema>> for Reader<'a, T>
impl<T: TryFrom<u16, Error = NotInSchema>> IndexMove<u32, ::core::result::Result<T, NotInSchema>>
for Reader<'_, T>
{
fn index_move(&self, index: u32) -> ::core::result::Result<T, NotInSchema> {
self.get(index)
}
}

impl<'a, T: TryFrom<u16, Error = NotInSchema>> Reader<'a, T> {
impl<T: TryFrom<u16, Error = NotInSchema>> Reader<'_, T> {
/// Gets the `T` at position `index`. Panics if `index` is greater than or
/// equal to `len()`.
pub fn get(&self, index: u32) -> ::core::result::Result<T, NotInSchema> {
Expand Down Expand Up @@ -167,7 +167,7 @@ impl<'a, T: TryFrom<u16, Error = NotInSchema>> FromPointerBuilder<'a> for Builde
}
}

impl<'a, T: Into<u16> + TryFrom<u16, Error = NotInSchema>> Builder<'a, T> {
impl<T: Into<u16> + TryFrom<u16, Error = NotInSchema>> Builder<'_, T> {
/// Gets the `T` at position `index`. Panics if `index` is greater than or
/// equal to `len()`.
pub fn get(&self, index: u32) -> ::core::result::Result<T, NotInSchema> {
Expand Down Expand Up @@ -292,8 +292,8 @@ impl<'a, T: TryFrom<u16, Error = NotInSchema> + crate::introspect::Introspect>
}
}

impl<'a, T: Copy + TryFrom<u16, Error = NotInSchema> + crate::introspect::Introspect>
core::fmt::Debug for Reader<'a, T>
impl<T: Copy + TryFrom<u16, Error = NotInSchema> + crate::introspect::Introspect> core::fmt::Debug
for Reader<'_, T>
{
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
core::fmt::Debug::fmt(
Expand Down
2 changes: 1 addition & 1 deletion capnp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ impl<'a> core::ops::Deref for OutputSegments<'a> {
}
}

impl<'s> message::ReaderSegments for OutputSegments<'s> {
impl message::ReaderSegments for OutputSegments<'_> {
fn get_segment(&self, id: u32) -> Option<&[u8]> {
match self {
OutputSegments::SingleSegment(s) => s.get(id as usize).copied(),
Expand Down
6 changes: 3 additions & 3 deletions capnp/src/list_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ where
}
}

impl<'a, T> Copy for Reader<'a, T> where T: crate::traits::Owned {}
impl<T> Copy for Reader<'_, T> where T: crate::traits::Owned {}

impl<'a, T> IndexMove<u32, Result<T::Reader<'a>>> for Reader<'a, T>
where
Expand Down Expand Up @@ -182,7 +182,7 @@ where
}
}

impl<'a, T> Builder<'a, T>
impl<T> Builder<'_, T>
where
T: crate::traits::Owned,
{
Expand Down Expand Up @@ -315,7 +315,7 @@ impl<'a, T: crate::traits::Owned> crate::dynamic_value::DowncastBuilder<'a> for
}
}

impl<'a, T: crate::traits::Owned> core::fmt::Debug for Reader<'a, T> {
impl<T: crate::traits::Owned> core::fmt::Debug for Reader<'_, T> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
core::fmt::Debug::fmt(
&::core::convert::Into::<crate::dynamic_value::Reader<'_>>::into(*self),
Expand Down
10 changes: 5 additions & 5 deletions capnp/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl<'a> SegmentArray<'a> {
}
}

impl<'b> ReaderSegments for SegmentArray<'b> {
impl ReaderSegments for SegmentArray<'_> {
fn get_segment(&self, id: u32) -> Option<&[u8]> {
self.segments.get(id as usize).copied()
}
Expand All @@ -199,7 +199,7 @@ impl<'b> ReaderSegments for SegmentArray<'b> {
}
}

impl<'b> ReaderSegments for [&'b [u8]] {
impl ReaderSegments for [&[u8]] {
fn get_segment(&self, id: u32) -> Option<&[u8]> {
self.get(id as usize).copied()
}
Expand Down Expand Up @@ -871,7 +871,7 @@ impl<'a> ScratchSpaceHeapAllocator<'a> {
}

#[cfg(feature = "alloc")]
unsafe impl<'a> Allocator for ScratchSpaceHeapAllocator<'a> {
unsafe impl Allocator for ScratchSpaceHeapAllocator<'_> {
fn allocate_segment(&mut self, minimum_size: u32) -> (*mut u8, u32) {
if (minimum_size as usize) < (self.scratch_space.len() / BYTES_PER_WORD)
&& !self.scratch_space_allocated
Expand Down Expand Up @@ -953,7 +953,7 @@ impl<'a> SingleSegmentAllocator<'a> {
}
}

unsafe impl<'a> Allocator for SingleSegmentAllocator<'a> {
unsafe impl Allocator for SingleSegmentAllocator<'_> {
fn allocate_segment(&mut self, minimum_size: u32) -> (*mut u8, u32) {
let available_word_count = self.segment.len() / BYTES_PER_WORD;
if (minimum_size as usize) > available_word_count {
Expand Down Expand Up @@ -989,7 +989,7 @@ unsafe impl<'a> Allocator for SingleSegmentAllocator<'a> {
}
}

unsafe impl<'a, A> Allocator for &'a mut A
unsafe impl<A> Allocator for &'_ mut A
where
A: Allocator,
{
Expand Down
10 changes: 5 additions & 5 deletions capnp/src/primitive_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ impl<'a, T: PrimitiveElement> FromPointerReader<'a> for Reader<'a, T> {
}
}

impl<'a, T: PrimitiveElement> IndexMove<u32, T> for Reader<'a, T> {
impl<T: PrimitiveElement> IndexMove<u32, T> for Reader<'_, T> {
fn index_move(&self, index: u32) -> T {
self.get(index)
}
}

impl<'a, T: PrimitiveElement> Reader<'a, T> {
impl<T: PrimitiveElement> Reader<'_, T> {
/// Gets the `T` at position `index`. Panics if `index` is greater than or
/// equal to `len()`.
pub fn get(&self, index: u32) -> T {
Expand Down Expand Up @@ -248,7 +248,7 @@ impl<'a, T: PrimitiveElement> FromPointerBuilder<'a> for Builder<'a, T> {
}
}

impl<'a, T: PrimitiveElement> Builder<'a, T> {
impl<T: PrimitiveElement> Builder<'_, T> {
/// Gets the `T` at position `index`. Panics if `index` is greater than or
/// equal to `len()`.
pub fn get(&self, index: u32) -> T {
Expand Down Expand Up @@ -381,8 +381,8 @@ impl<'a, T: PrimitiveElement + crate::introspect::Introspect>
}
}

impl<'a, T: Copy + PrimitiveElement + crate::introspect::Introspect> core::fmt::Debug
for Reader<'a, T>
impl<T: Copy + PrimitiveElement + crate::introspect::Introspect> core::fmt::Debug
for Reader<'_, T>
{
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
core::fmt::Debug::fmt(
Expand Down
2 changes: 1 addition & 1 deletion capnp/src/stringify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ pub(crate) fn print(
}
}

impl<'a> fmt::Debug for dynamic_value::Reader<'a> {
impl fmt::Debug for dynamic_value::Reader<'_> {
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
let indent = if f.alternate() {
Indent::enabled()
Expand Down
8 changes: 4 additions & 4 deletions capnp/src/struct_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ where
*self
}
}
impl<'a, T> Copy for Reader<'a, T> where T: crate::traits::OwnedStruct {}
impl<T> Copy for Reader<'_, T> where T: crate::traits::OwnedStruct {}

impl<'a, T> Reader<'a, T>
where
Expand All @@ -90,7 +90,7 @@ where
}
}

impl<'a, T> Reader<'a, T>
impl<T> Reader<'_, T>
where
T: crate::traits::OwnedStruct,
{
Expand Down Expand Up @@ -201,7 +201,7 @@ where
}
}

impl<'a, T> Builder<'a, T>
impl<T> Builder<'_, T>
where
T: crate::traits::OwnedStruct,
{
Expand Down Expand Up @@ -324,7 +324,7 @@ impl<'a, T: crate::traits::OwnedStruct> crate::dynamic_value::DowncastBuilder<'a
}
}

impl<'a, T: crate::traits::OwnedStruct> core::fmt::Debug for Reader<'a, T> {
impl<T: crate::traits::OwnedStruct> core::fmt::Debug for Reader<'_, T> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
core::fmt::Debug::fmt(
&::core::convert::Into::<crate::dynamic_value::Reader<'_>>::into(*self),
Expand Down
8 changes: 4 additions & 4 deletions capnp/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl<'a> core::cmp::PartialEq<Reader<'a>> for &'a str {
}

#[cfg(feature = "alloc")]
impl<'a> core::cmp::PartialEq<alloc::string::String> for Reader<'a> {
impl core::cmp::PartialEq<alloc::string::String> for Reader<'_> {
#[inline]
fn eq(&self, other: &alloc::string::String) -> bool {
self.as_bytes() == other.as_bytes()
Expand Down Expand Up @@ -92,7 +92,7 @@ impl<'a> core::cmp::PartialOrd<Reader<'a>> for &'a str {
}
}

impl<'a> core::fmt::Debug for Reader<'a> {
impl core::fmt::Debug for Reader<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.to_str() {
Ok(s) => write!(f, "{:?}", s),
Expand Down Expand Up @@ -179,7 +179,7 @@ pub struct Builder<'a> {
pos: usize,
}

impl<'a> core::cmp::PartialEq for Builder<'a> {
impl core::cmp::PartialEq for Builder<'_> {
fn eq(&self, other: &Self) -> bool {
self.bytes == other.bytes
}
Expand Down Expand Up @@ -285,7 +285,7 @@ impl<'a> Builder<'a> {
}
}

impl<'a> core::fmt::Debug for Builder<'a> {
impl core::fmt::Debug for Builder<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.reborrow_as_reader().to_str() {
Ok(s) => write!(f, "{:?}", s),
Expand Down
2 changes: 1 addition & 1 deletion capnp/src/text_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ impl<'a> crate::dynamic_value::DowncastBuilder<'a> for Builder<'a> {
}
}

impl<'a> core::fmt::Debug for Reader<'a> {
impl core::fmt::Debug for Reader<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
core::fmt::Debug::fmt(
&::core::convert::Into::<crate::dynamic_value::Reader<'_>>::into(*self),
Expand Down

0 comments on commit a4184b3

Please sign in to comment.