clippy
30 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 30 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.71.1 (eb26296b5 2023-08-03)
- cargo 1.71.1 (7f1d04c00 2023-07-29)
- clippy 0.1.71 (eb26296 2023-08-03)
Annotations
Check warning on line 241 in pilota-build/src/lib.rs
github-actions / clippy
this function has too many arguments (8/7)
warning: this function has too many arguments (8/7)
--> pilota-build/src/lib.rs:232:5
|
232 | / pub fn build_cx(
233 | | services: Vec<IdlService>,
234 | | out: Option<Output>,
235 | | mut parser: P,
... |
240 | | keep_unknown_fields: Vec<PathBuf>,
241 | | ) -> Context {
| |________________^
|
= 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
Check warning on line 172 in pilota-build/src/resolve.rs
github-actions / clippy
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> pilota-build/src/resolve.rs:167:13
|
167 | / match &item.kind {
168 | | ir::ItemKind::Enum(e) => e.variants.iter().for_each(|e| {
169 | | self.def_sym(Namespace::Value, (*e.name).clone());
170 | | }),
171 | | _ => {}
172 | | }
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
= note: `#[warn(clippy::single_match)]` on by default
help: try this
|
167 ~ if let ir::ItemKind::Enum(e) = &item.kind { e.variants.iter().for_each(|e| {
168 + self.def_sym(Namespace::Value, (*e.name).clone());
169 + }) }
|
Check warning on line 66 in pilota-build/src/parser/protobuf/mod.rs
github-actions / clippy
parameter is only used in recursion
warning: parameter is only used in recursion
--> pilota-build/src/parser/protobuf/mod.rs:66:9
|
66 | message_name: Option<&str>,
| ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_message_name`
|
note: parameter used here
--> pilota-build/src/parser/protobuf/mod.rs:81:33
|
81 | ... message_name,
| ^^^^^^^^^^^^
...
87 | ... message_name,
| ^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#only_used_in_recursion
= note: `#[warn(clippy::only_used_in_recursion)]` on by default
Check warning on line 355 in pilota-build/src/middle/context.rs
github-actions / clippy
if let .. else expression looks like `matches!` macro
warning: if let .. else expression looks like `matches!` macro
--> pilota-build/src/middle/context.rs:347:33
|
347 | / ... if let Some(crate::tags::KeepUnknownFields(false)) =
348 | | ... cx.db.tags_map().get(&tags).and_then(|tags| {
349 | | ... tags.get::<crate::tags::KeepUnknownFields>()
350 | | ... })
... |
354 | | ... true
355 | | ... }
| |_______________________^
|
= 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
|
347 ~ !matches!(cx.db.tags_map().get(&tags).and_then(|tags| {
348 + tags.get::<crate::tags::KeepUnknownFields>()
349 + }), Some(crate::tags::KeepUnknownFields(false)))
|
Check warning on line 336 in pilota-build/src/middle/context.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> pilota-build/src/middle/context.rs:336:38
|
336 | let file = files.get(&file_id).unwrap();
| ^^^^^^^^ help: change this to: `file_id`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 205 in pilota-build/src/middle/context.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> pilota-build/src/middle/context.rs:205:62
|
205 | PathCollector { cx, set }.visit_path(&p);
| ^^ help: change this to: `p`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: `#[warn(clippy::needless_borrow)]` on by default
Check warning on line 1649 in pilota/src/thrift/compact.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> pilota/src/thrift/compact.rs:1649:18
|
1649 | unsafe { return Ok(FastStr::from_bytes_unchecked(bytes)) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= help: remove `return`
Check warning on line 428 in pilota-build/src/codegen/mod.rs
github-actions / clippy
this lifetime isn't used in the function definition
warning: this lifetime isn't used in the function definition
--> pilota-build/src/codegen/mod.rs:428:24
|
428 | pub fn write_items<'a>(&self, stream: &mut String, items: impl Iterator<Item = CodegenItem>)
| ^^
|
= 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
Check warning on line 677 in pilota-build/src/codegen/thrift/mod.rs
github-actions / clippy
useless use of `format!`
warning: useless use of `format!`
--> pilota-build/src/codegen/thrift/mod.rs:672:33
|
672 | / ... format!(
673 | | ... r#"Err(::pilota::thrift::DecodeError::new(
674 | | ... ::pilota::thrift::DecodeErrorKind::InvalidData,
675 | | ... "received empty union from remote Message")
676 | | ... )"#
677 | | ... )
| |_______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
= note: `#[warn(clippy::useless_format)]` on by default
help: consider using `.to_string()`
|
672 ~ r#"Err(::pilota::thrift::DecodeError::new(
673 + ::pilota::thrift::DecodeErrorKind::InvalidData,
674 + "received empty union from remote Message")
675 + )"#.to_string()
|
Check warning on line 1169 in pilota/src/thrift/binary_unsafe.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> pilota/src/thrift/binary_unsafe.rs:1169:9
|
1169 | &mut self.trans
| ^^^^^^^^^^^^^^^ help: change this to: `self.trans`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: `#[warn(clippy::needless_borrow)]` on by default
Check warning on line 1107 in pilota/src/thrift/binary_unsafe.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> pilota/src/thrift/binary_unsafe.rs:1107:13
|
1107 | return Ok(FastStr::from_bytes_unchecked(bytes));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= help: remove `return`
Check warning on line 316 in pilota-build/src/codegen/thrift/mod.rs
github-actions / clippy
writing `&mut String` instead of `&mut str` involves a new object where a slice will do
warning: writing `&mut String` instead of `&mut str` involves a new object where a slice will do
--> pilota-build/src/codegen/thrift/mod.rs:316:59
|
316 | fn codegen_entry_enum(&self, _def_id: DefId, _stream: &mut String, _e: &rir::Enum) {
| ^^^^^^^^^^^ help: change this to: `&mut str`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: `#[warn(clippy::ptr_arg)]` on by default
Check warning on line 738 in pilota/src/thrift/binary_unsafe.rs
github-actions / clippy
use of `offset` with a `usize` casted to an `isize`
warning: use of `offset` with a `usize` casted to an `isize`
--> pilota/src/thrift/binary_unsafe.rs:738:17
|
738 | self.buf.as_mut_ptr().offset(self.index as isize),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.buf.as_mut_ptr().add(self.index)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_offset_with_cast
Check warning on line 683 in pilota/src/thrift/binary_unsafe.rs
github-actions / clippy
use of `offset` with a `usize` casted to an `isize`
warning: use of `offset` with a `usize` casted to an `isize`
--> pilota/src/thrift/binary_unsafe.rs:683:17
|
683 | self.buf.as_mut_ptr().offset(self.index as isize),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.buf.as_mut_ptr().add(self.index)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_offset_with_cast
Check warning on line 674 in pilota/src/thrift/binary_unsafe.rs
github-actions / clippy
use of `offset` with a `usize` casted to an `isize`
warning: use of `offset` with a `usize` casted to an `isize`
--> pilota/src/thrift/binary_unsafe.rs:674:21
|
674 | self.trans.bytes_mut().as_mut_ptr().offset(l as isize),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.trans.bytes_mut().as_mut_ptr().add(l)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_offset_with_cast
Check warning on line 653 in pilota/src/thrift/binary_unsafe.rs
github-actions / clippy
use of `offset` with a `usize` casted to an `isize`
warning: use of `offset` with a `usize` casted to an `isize`
--> pilota/src/thrift/binary_unsafe.rs:653:17
|
653 | self.buf.as_mut_ptr().offset(self.index as isize),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.buf.as_mut_ptr().add(self.index)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_offset_with_cast
Check warning on line 551 in pilota/src/thrift/binary_unsafe.rs
github-actions / clippy
use of `offset` with a `usize` casted to an `isize`
warning: use of `offset` with a `usize` casted to an `isize`
--> pilota/src/thrift/binary_unsafe.rs:551:17
|
551 | self.buf.as_mut_ptr().offset(self.index as isize),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.buf.as_mut_ptr().add(self.index)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_offset_with_cast
Check warning on line 542 in pilota/src/thrift/binary_unsafe.rs
github-actions / clippy
use of `offset` with a `usize` casted to an `isize`
warning: use of `offset` with a `usize` casted to an `isize`
--> pilota/src/thrift/binary_unsafe.rs:542:21
|
542 | self.trans.bytes_mut().as_mut_ptr().offset(l as isize),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.trans.bytes_mut().as_mut_ptr().add(l)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_offset_with_cast
Check warning on line 448 in pilota/src/thrift/binary_unsafe.rs
github-actions / clippy
use of `offset` with a `usize` casted to an `isize`
warning: use of `offset` with a `usize` casted to an `isize`
--> pilota/src/thrift/binary_unsafe.rs:448:17
|
448 | self.buf.as_mut_ptr().offset(self.index as isize),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.buf.as_mut_ptr().add(self.index)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_offset_with_cast
Check warning on line 393 in pilota/src/thrift/binary_unsafe.rs
github-actions / clippy
use of `offset` with a `usize` casted to an `isize`
warning: use of `offset` with a `usize` casted to an `isize`
--> pilota/src/thrift/binary_unsafe.rs:393:17
|
393 | self.buf.as_mut_ptr().offset(self.index as isize),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.buf.as_mut_ptr().add(self.index)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_offset_with_cast
Check warning on line 379 in pilota/src/thrift/binary_unsafe.rs
github-actions / clippy
use of `offset` with a `usize` casted to an `isize`
warning: use of `offset` with a `usize` casted to an `isize`
--> pilota/src/thrift/binary_unsafe.rs:379:17
|
379 | self.buf.as_mut_ptr().offset(self.index as isize),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.buf.as_mut_ptr().add(self.index)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_offset_with_cast
Check warning on line 277 in pilota/src/thrift/binary_unsafe.rs
github-actions / clippy
use of `offset` with a `usize` casted to an `isize`
warning: use of `offset` with a `usize` casted to an `isize`
--> pilota/src/thrift/binary_unsafe.rs:277:17
|
277 | self.buf.as_mut_ptr().offset(self.index as isize),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.buf.as_mut_ptr().add(self.index)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_offset_with_cast
= note: `#[warn(clippy::ptr_offset_with_cast)]` on by default
Check warning on line 913 in pilota/src/thrift/binary_le.rs
github-actions / clippy
unneeded `return` statement
warning: unneeded `return` statement
--> pilota/src/thrift/binary_le.rs:913:18
|
913 | unsafe { return Ok(FastStr::from_bytes_unchecked(bytes)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
= help: remove `return`
Check warning on line 120 in pilota-build/src/codegen/workspace.rs
github-actions / clippy
redundant closure
warning: redundant closure
--> pilota-build/src/codegen/workspace.rs:120:18
|
120 | .map(|s| FastStr::new(s))
| ^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `FastStr::new`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
= note: `#[warn(clippy::redundant_closure)]` on by default
Check warning on line 9 in pilota-build/src/codegen/toml.rs
github-actions / clippy
use Vec::sort_by_key here instead
warning: use Vec::sort_by_key here instead
--> pilota-build/src/codegen/toml.rs:9:13
|
9 | a.sort_by(|a, b| a.to_string().cmp(&b.to_string()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.sort_by_key(|a| a.to_string())`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by
= note: `#[warn(clippy::unnecessary_sort_by)]` on by default