You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Manually fix a part of the remaining clippy warnings in capnp
Summary of fixed clippy errors and warnings:
error: this public function might dereference a raw pointer but is not marked `unsafe`
error: this `if` has identical blocks
warning: match expression looks like `matches!` macro
warning: very complex type used. Consider factoring parts into `type` definitions
warning: this function has too many arguments (10/7)
warning: methods called `into_*` usually take `self` by value
warning: struct `FieldList` has a public `len` method, but no `is_empty` method
warning: this lifetime isn't used in the impl
$ cargo clippy
Checking capnp v0.17.2 (/home/amiculas/work/capnproto-rust/capnp)
warning: match expression looks like `matches!` macro
--> capnp/src/introspect.rs:99:13
|
99 | / match self.base {
100 | | BaseType::Text
101 | | | BaseType::Data
102 | | | BaseType::AnyPointer
... |
105 | | _ => false,
106 | | }
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
= note: `#[warn(clippy::match_like_matches_macro)]` on by default
help: try this
|
99 ~ matches!(self.base, BaseType::Text
100 + | BaseType::Data
101 + | BaseType::AnyPointer
102 + | BaseType::Struct(_)
103 + | BaseType::Capability)
|
warning: very complex type used. Consider factoring parts into `type` definitions
--> capnp/src/private/capability.rs:40:10
|
40 | ) -> Option<(
| __________^
41 | | u32,
42 | | crate::capability::Promise<(), crate::Error>,
43 | | Box<dyn PipelineHook>,
44 | | )>;
| |______^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
= note: `#[warn(clippy::type_complexity)]` on by default
error: this public function might dereference a raw pointer but is not marked `unsafe`
--> capnp/src/private/layout.rs:164:48
|
164 | unsafe { this_addr.offset(8 * (1 + (((*ptr).offset_and_kind.get() as i32) >> 2)) as isize) }
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref
= note: `#[deny(clippy::not_unsafe_ptr_arg_deref)]` on by default
warning: this function has too many arguments (10/7)
--> capnp/src/private/layout.rs:2187:5
|
2187 | / pub unsafe fn copy_pointer(
2188 | | dst_arena: &mut dyn BuilderArena,
2189 | | dst_segment_id: u32,
2190 | | #[cfg(feature = "alloc")] dst_cap_table: CapTableBuilder,
... |
2197 | | canonicalize: bool,
2198 | | ) -> Result<SegmentAnd<*mut u8>> {
| |____________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
= note: `#[warn(clippy::too_many_arguments)]` on by default
warning: methods called `into_*` usually take `self` by value
--> capnp/src/private/layout.rs:4170:34
|
4170 | pub(crate) fn into_raw_bytes(&self) -> &'a m�[Iut [u8] {
| ^^^^^
|
= help: consider choosing a less ambiguous name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
= note: `#[warn(clippy::wrong_self_convention)]` on by default
warning: struct `FieldList` has a public `len` method, but no `is_empty` method
--> capnp/src/schema.rs:160:5
|
160 | pub fn len(&self) -> u16 {
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty
= note: `#[warn(clippy::len_without_is_empty)]` on by default
warning: this lifetime isn't used in the impl
--> capnp/src/schema.rs:177:6
|
177 | impl<'a> IndexMove<u16, Field> for FieldList {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
= note: `#[warn(clippy::extra_unused_lifetimes)]` on by default
warning: this lifetime isn't used in the impl
--> capnp/src/schema.rs:183:6
|
183 | impl<'a> ::core::iter::IntoIterator for FieldList {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
warning: this lifetime isn't used in the impl
--> capnp/src/schema.rs:223:6
|
223 | impl<'a> IndexMove<u16, Field> for FieldSubset {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
warning: this lifetime isn't used in the impl
--> capnp/src/schema.rs:229:6
|
229 | impl<'a> ::core::iter::IntoIterator for FieldSubset {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
warning: this lifetime isn't used in the impl
--> capnp/src/schema.rs:344:6
|
344 | impl<'a> IndexMove<u16, Enumerant> for EnumerantList {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
warning: this lifetime isn't used in the impl
--> capnp/src/schema.rs:350:6
|
350 | impl<'a> ::core::iter::IntoIterator for EnumerantList {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
warning: this lifetime isn't used in the impl
--> capnp/src/schema.rs:417:6
|
417 | impl<'a> IndexMove<u32, Annotation> for AnnotationList {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
warning: this lifetime isn't used in the impl
--> capnp/src/schema.rs:423:6
|
423 | impl<'a> ::core::iter::IntoIterator for AnnotationList {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
error: this `if` has identical blocks
--> capnp/src/serialize.rs:355:46
|
355 | if segment_count >= SEGMENTS_COUNT_LIMIT {
| ______________________________________________^
356 | | return Err(Error::from_kind(ErrorKind::InvalidNumberOfSegments(
357 | | segment_count,
358 | | )));
359 | | } else if segment_count == 0 {
| |_____^
|
note: same as this
--> capnp/src/serialize.rs:359:34
|
359 | } else if segment_count == 0 {
| __________________________________^
360 | | return Err(Error::from_kind(ErrorKind::InvalidNumberOfSegments(
361 | | segment_count,
362 | | )));
363 | | }
| |_____^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else
= note: `#[deny(clippy::if_same_then_else)]` on by default
warning: `capnp` (lib) generated 16 warnings
error: could not compile `capnp` (lib) due to 2 previous errors; 16 warnings emitted
0 commit comments