Fixed most clippy warnings #26
development.yml
on: push
Matrix: Test / Build & Test
Matrix: Coverage / Coverage
Analyze
/
Check | Clippy
26s
Analyze
/
Check | Audit
15s
Analyze
/
Format Code
20s
Release
/
Create Pre Release
0s
Release
/
Create Release Pull Request
0s
Annotations
28 warnings
struct `Msg1Items` has a public `len` method, but no `is_empty` method:
/home/runner/work/tools.proto/tools.proto/runtime/src/message/macros.rs#L53
warning: struct `Msg1Items` has a public `len` method, but no `is_empty` method
--> /home/runner/work/tools.proto/tools.proto/target/debug/build/testprog-84808efcdbe1e353/out/arrays/messages.rs:21:1
|
21 | bp3d_proto::generate_array_wrapper!(Msg1Items, Item, bp3d_proto::message::util::ValueLE<u8>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty
= note: this warning originates in the macro `bp3d_proto::generate_array_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)
|
struct `MsgItems` has a public `len` method, but no `is_empty` method:
/home/runner/work/tools.proto/tools.proto/runtime/src/message/macros.rs#L53
warning: struct `MsgItems` has a public `len` method, but no `is_empty` method
--> /home/runner/work/tools.proto/tools.proto/target/debug/build/testprog-84808efcdbe1e353/out/arrays/messages.rs:9:1
|
9 | bp3d_proto::generate_array_wrapper!(MsgItems, Item, bp3d_proto::message::util::ValueLE<u8>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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
= note: this warning originates in the macro `bp3d_proto::generate_array_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)
|
you should consider adding a `Default` implementation for `Loader`:
compiler/src/interface.rs#L44
warning: you should consider adding a `Default` implementation for `Loader`
--> compiler/src/interface.rs:44:5
|
44 | / pub fn new() -> Self {
45 | | Self {
46 | | models: Vec::new(),
47 | | imported_models: Vec::new(),
48 | | }
49 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try adding this
|
43 + impl Default for Loader {
44 + fn default() -> Self {
45 + Self::new()
46 + }
47 + }
|
|
all variants have the same postfix: `Case`:
compiler/src/gen/template/util.rs#L33
warning: all variants have the same postfix: `Case`
--> compiler/src/gen/template/util.rs:33:1
|
33 | / enum Convention {
34 | | PascalCase,
35 | | SnakeCase,
36 | | ScreamingCase,
37 | | }
| |_^
|
= help: remove the postfixes and use full paths to the variants instead of glob imports
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names
= note: `#[warn(clippy::enum_variant_names)]` on by default
|
deref on an immutable reference:
compiler/src/compiler/util.rs#L57
warning: deref on an immutable reference
--> compiler/src/compiler/util.rs:57:24
|
57 | Some(v) => &*v,
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref
= note: `#[warn(clippy::borrow_deref_ref)]` on by default
help: if you would like to reborrow, try removing `&*`
|
57 | Some(v) => v,
| ~
help: if you would like to deref, try using `&**`
|
57 | Some(v) => &**v,
| ~~~~
|
you should consider adding a `Default` implementation for `TypePathMap`:
compiler/src/compiler/util.rs#L44
warning: you should consider adding a `Default` implementation for `TypePathMap`
--> compiler/src/compiler/util.rs:44:5
|
44 | / pub fn new() -> Self {
45 | | Self {
46 | | type_path_by_name: HashMap::new(),
47 | | }
48 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
= note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this
|
43 + impl Default for TypePathMap {
44 + fn default() -> Self {
45 + Self::new()
46 + }
47 + }
|
|
you should consider adding a `Default` implementation for `Loader`:
compiler/src/interface.rs#L44
warning: you should consider adding a `Default` implementation for `Loader`
--> compiler/src/interface.rs:44:5
|
44 | / pub fn new() -> Self {
45 | | Self {
46 | | models: Vec::new(),
47 | | imported_models: Vec::new(),
48 | | }
49 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try adding this
|
43 + impl Default for Loader {
44 + fn default() -> Self {
45 + Self::new()
46 + }
47 + }
|
|
all variants have the same postfix: `Case`:
compiler/src/gen/template/util.rs#L33
warning: all variants have the same postfix: `Case`
--> compiler/src/gen/template/util.rs:33:1
|
33 | / enum Convention {
34 | | PascalCase,
35 | | SnakeCase,
36 | | ScreamingCase,
37 | | }
| |_^
|
= help: remove the postfixes and use full paths to the variants instead of glob imports
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names
= note: `#[warn(clippy::enum_variant_names)]` on by default
|
deref on an immutable reference:
compiler/src/compiler/util.rs#L57
warning: deref on an immutable reference
--> compiler/src/compiler/util.rs:57:24
|
57 | Some(v) => &*v,
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref
= note: `#[warn(clippy::borrow_deref_ref)]` on by default
help: if you would like to reborrow, try removing `&*`
|
57 | Some(v) => v,
| ~
help: if you would like to deref, try using `&**`
|
57 | Some(v) => &**v,
| ~~~~
|
you should consider adding a `Default` implementation for `TypePathMap`:
compiler/src/compiler/util.rs#L44
warning: you should consider adding a `Default` implementation for `TypePathMap`
--> compiler/src/compiler/util.rs:44:5
|
44 | / pub fn new() -> Self {
45 | | Self {
46 | | type_path_by_name: HashMap::new(),
47 | | }
48 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
= note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this
|
43 + impl Default for TypePathMap {
44 + fn default() -> Self {
45 + Self::new()
46 + }
47 + }
|
|
this `else { if .. }` block can be collapsed:
compiler/src/gen/template/core.rs#L95
warning: this `else { if .. }` block can be collapsed
--> compiler/src/gen/template/core.rs:95:32
|
95 | } else {
| ________________________________^
96 | | if let Some(component) =
97 | | token.pop()?.map(|v| Component::parse_variable(&function_map, v))
98 | | {
99 | | cur_fragment.content.push(component?);
100 | | }
101 | | }
| |_________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
= note: `#[warn(clippy::collapsible_else_if)]` on by default
help: collapse nested if block
|
95 ~ } else if let Some(component) =
96 + token.pop()?.map(|v| Component::parse_variable(&function_map, v))
97 + {
98 + cur_fragment.content.push(component?);
99 + }
|
|
this `else { if .. }` block can be collapsed:
compiler/src/gen/template/core.rs#L95
warning: this `else { if .. }` block can be collapsed
--> compiler/src/gen/template/core.rs:95:32
|
95 | } else {
| ________________________________^
96 | | if let Some(component) =
97 | | token.pop()?.map(|v| Component::parse_variable(&function_map, v))
98 | | {
99 | | cur_fragment.content.push(component?);
100 | | }
101 | | }
| |_________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
= note: `#[warn(clippy::collapsible_else_if)]` on by default
help: collapse nested if block
|
95 ~ } else if let Some(component) =
96 + token.pop()?.map(|v| Component::parse_variable(&function_map, v))
97 + {
98 + cur_fragment.content.push(component?);
99 + }
|
|
use of `default` to create a unit struct:
runtime/src/message/util/list.rs#L127
warning: use of `default` to create a unit struct
--> runtime/src/message/util/list.rs:127:33
|
127 | useless: PhantomData::default(),
| ^^^^^^^^^^^ help: remove this call to `default`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#default_constructed_unit_structs
|
use of `default` to create a unit struct:
runtime/src/message/util/list.rs#L119
warning: use of `default` to create a unit struct
--> runtime/src/message/util/list.rs:119:33
|
119 | useless: PhantomData::default(),
| ^^^^^^^^^^^ help: remove this call to `default`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#default_constructed_unit_structs
|
redundant slicing of the whole range:
runtime/src/message/util/list.rs#L104
warning: redundant slicing of the whole range
--> runtime/src/message/util/list.rs:104:55
|
104 | let msg = match Item::from_slice_with_offsets(&self.data[..]) {
| ^^^^^^^^^^^^^^ help: use the original value instead: `self.data`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_slicing
= note: `#[warn(clippy::redundant_slicing)]` on by default
|
struct `List` has a public `len` method, but no `is_empty` method:
runtime/src/message/util/list_base.rs#L45
warning: struct `List` has a public `len` method, but no `is_empty` method
--> runtime/src/message/util/list_base.rs:45:13
|
45 | pub fn len(&self) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
::: runtime/src/message/util/list.rs:42:1
|
42 | impl_list_base!(List);
| --------------------- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty
= note: this warning originates in the macro `impl_list_base` (in Nightly builds, run with -Z macro-backtrace for more info)
|
unsafe function's docs miss `# Safety` section:
runtime/src/message/util/list_base.rs#L32
warning: unsafe function's docs miss `# Safety` section
--> runtime/src/message/util/list_base.rs:32:13
|
32 | pub unsafe fn from_raw_parts(data: B, len: usize) -> $t<B, T, Item> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
::: runtime/src/message/util/list.rs:42:1
|
42 | impl_list_base!(List);
| --------------------- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc
= note: this warning originates in the macro `impl_list_base` (in Nightly builds, run with -Z macro-backtrace for more info)
|
length comparison to one:
runtime/src/message/util/common.rs#L62
warning: length comparison to one
--> runtime/src/message/util/common.rs:62:12
|
62 | if slice.len() < 1 {
| ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `slice.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
|
length comparison to one:
runtime/src/message/util/common.rs#L40
warning: length comparison to one
--> runtime/src/message/util/common.rs:40:12
|
40 | if slice.len() < 1 {
| ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `slice.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
= note: `#[warn(clippy::len_zero)]` on by default
|
use of `default` to create a unit struct:
runtime/src/message/util/array.rs#L131
warning: use of `default` to create a unit struct
--> runtime/src/message/util/array.rs:131:42
|
131 | useless1: PhantomData::default(),
| ^^^^^^^^^^^ help: remove this call to `default`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#default_constructed_unit_structs
|
use of `default` to create a unit struct:
runtime/src/message/util/array.rs#L130
warning: use of `default` to create a unit struct
--> runtime/src/message/util/array.rs:130:41
|
130 | useless: PhantomData::default(),
| ^^^^^^^^^^^ help: remove this call to `default`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#default_constructed_unit_structs
|
use of `default` to create a unit struct:
runtime/src/message/util/array.rs#L106
warning: use of `default` to create a unit struct
--> runtime/src/message/util/array.rs:106:33
|
106 | useless: PhantomData::default(),
| ^^^^^^^^^^^ help: remove this call to `default`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#default_constructed_unit_structs
|
use of `default` to create a unit struct:
runtime/src/message/util/array.rs#L91
warning: use of `default` to create a unit struct
--> runtime/src/message/util/array.rs:91:33
|
91 | useless: PhantomData::default(),
| ^^^^^^^^^^^ help: remove this call to `default`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#default_constructed_unit_structs
|
struct `Array` has a public `len` method, but no `is_empty` method:
runtime/src/message/util/list_base.rs#L45
warning: struct `Array` has a public `len` method, but no `is_empty` method
--> runtime/src/message/util/list_base.rs:45:13
|
45 | pub fn len(&self) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
::: runtime/src/message/util/array.rs:44:1
|
44 | impl_list_base!(Array);
| ---------------------- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty
= note: this warning originates in the macro `impl_list_base` (in Nightly builds, run with -Z macro-backtrace for more info)
|
unsafe function's docs miss `# Safety` section:
runtime/src/message/util/list_base.rs#L32
warning: unsafe function's docs miss `# Safety` section
--> runtime/src/message/util/list_base.rs:32:13
|
32 | pub unsafe fn from_raw_parts(data: B, len: usize) -> $t<B, T, Item> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
::: runtime/src/message/util/array.rs:44:1
|
44 | impl_list_base!(Array);
| ---------------------- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc
= note: `#[warn(clippy::missing_safety_doc)]` on by default
= note: this warning originates in the macro `impl_list_base` (in Nightly builds, run with -Z macro-backtrace for more info)
|
struct `ArrayCodec` has a public `len` method, but no `is_empty` method:
runtime/src/codec/arrays.rs#L59
warning: struct `ArrayCodec` has a public `len` method, but no `is_empty` method
--> runtime/src/codec/arrays.rs:59:5
|
59 | pub fn len(&self) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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
|
use of `default` to create a unit struct:
runtime/src/codec/arrays.rs#L44
warning: use of `default` to create a unit struct
--> runtime/src/codec/arrays.rs:44:34
|
44 | useless1: PhantomData::default(),
| ^^^^^^^^^^^ help: remove this call to `default`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#default_constructed_unit_structs
|
use of `default` to create a unit struct:
runtime/src/codec/arrays.rs#L43
warning: use of `default` to create a unit struct
--> runtime/src/codec/arrays.rs:43:33
|
43 | useless: PhantomData::default(),
| ^^^^^^^^^^^ help: remove this call to `default`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#default_constructed_unit_structs
= note: `#[warn(clippy::default_constructed_unit_structs)]` on by default
|