Skip to content

Commit 5b42eef

Browse files
committed
more clippy suggestions
1 parent 9f5f979 commit 5b42eef

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

capnp/src/schema.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ impl FieldList {
157157
self.fields.len() as u16
158158
}
159159

160+
pub fn is_empty(&self) -> bool {
161+
self.len() == 0
162+
}
163+
160164
pub fn get(self, index: u16) -> Field {
161165
Field {
162166
proto: self.fields.get(index as u32),
@@ -337,13 +341,13 @@ impl EnumerantList {
337341
}
338342
}
339343

340-
impl<'a> IndexMove<u16, Enumerant> for EnumerantList {
344+
impl IndexMove<u16, Enumerant> for EnumerantList {
341345
fn index_move(&self, index: u16) -> Enumerant {
342346
self.get(index)
343347
}
344348
}
345349

346-
impl<'a> ::core::iter::IntoIterator for EnumerantList {
350+
impl ::core::iter::IntoIterator for EnumerantList {
347351
type Item = Enumerant;
348352
type IntoIter = ShortListIter<Self, Self::Item>;
349353

@@ -415,13 +419,13 @@ impl AnnotationList {
415419
}
416420
}
417421

418-
impl<'a> IndexMove<u32, Annotation> for AnnotationList {
422+
impl IndexMove<u32, Annotation> for AnnotationList {
419423
fn index_move(&self, index: u32) -> Annotation {
420424
self.get(index)
421425
}
422426
}
423427

424-
impl<'a> ::core::iter::IntoIterator for AnnotationList {
428+
impl ::core::iter::IntoIterator for AnnotationList {
425429
type Item = Annotation;
426430
type IntoIter = ListIter<Self, Self::Item>;
427431

capnp/src/serialize/no_alloc_buffer_segments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl<'b> NoAllocBufferSegments<&'b [u8]> {
115115
/// ALIGNMENT: If the "unaligned" feature is enabled, then there are no alignment requirements on `buffer`.
116116
/// Otherwise, `buffer` must be 8-byte aligned (attempts to read the message will trigger errors).
117117
pub fn from_slice(slice: &mut &'b [u8], options: ReaderOptions) -> Result<Self> {
118-
let segment_table_info = read_segment_table(&*slice, options)?;
118+
let segment_table_info = read_segment_table(slice, options)?;
119119

120120
let message_length = segment_table_info.segment_table_length_bytes
121121
+ segment_table_info.total_segments_length_bytes;

capnp/src/struct_list.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,7 @@ where
6868
T: crate::traits::OwnedStruct,
6969
{
7070
fn clone(&self) -> Reader<'a, T> {
71-
Reader {
72-
marker: self.marker,
73-
reader: self.reader,
74-
}
71+
*self
7572
}
7673
}
7774
impl<'a, T> Copy for Reader<'a, T> where T: crate::traits::OwnedStruct {}

0 commit comments

Comments
 (0)