Fixed clippy warning related to string references in write_to impleme… #20
development.yml
on: push
Matrix: Test / Build & Test
CodeCov
/
Coverage
1m 29s
Analyze
/
Check | Clippy
27s
Analyze
/
Check | Audit
17s
Analyze
/
Format Code
13s
Release
/
Create Pre Release
0s
Release
/
Create Release Pull Request
0s
Annotations
104 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)
|
unneeded late initialization:
compiler/src/interface.rs#L177
warning: unneeded late initialization
--> compiler/src/interface.rs:177:13
|
177 | let proto_path;
| ^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init
= note: `#[warn(clippy::needless_late_init)]` on by default
help: move the declaration `proto_path` here and remove the assignments from the branches
|
177 ~
178 ~ let proto_path = if umbrella.len() > 1 {
179 | let umbrella_path = out_path.join("umbrella.rs");
180 | std::fs::write(&umbrella_path, umbrella).map_err(Error::Io)?;
181 ~ umbrella_path
182 | } else {
183 ~ out_path
184 ~ };
|
|
manual implementation of `Option::map`:
compiler/src/interface.rs#L167
warning: manual implementation of `Option::map`
--> compiler/src/interface.rs:167:30
|
167 | Ok(o) => match o {
| ______________________________^
168 | | Some(o) => Some(Ok(o)),
169 | | None => None,
170 | | },
| |_____________________^ help: try: `o.map(Ok)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
|
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 + }
|
|
useless use of `format!`:
compiler/src/gen/template/util.rs#L133
warning: useless use of `format!`
--> compiler/src/gen/template/util.rs:133:9
|
133 | / format!(
134 | | "{}",
135 | | regex.find_iter(self.0).map(|v| v.as_str().to_uppercase()).join("_")
136 | | )
| |_________^ help: consider using `.to_string()`: `regex.find_iter(self.0).map(|v| v.as_str().to_uppercase()).join("_").to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
|
useless use of `format!`:
compiler/src/gen/template/util.rs#L119
warning: useless use of `format!`
--> compiler/src/gen/template/util.rs:119:9
|
119 | / format!(
120 | | "{}",
121 | | regex.find_iter(self.0).map(|v| v.as_str().to_lowercase()).join("_")
122 | | )
| |_________^ help: consider using `.to_string()`: `regex.find_iter(self.0).map(|v| v.as_str().to_lowercase()).join("_").to_string()`
|
= 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
|
length comparison to zero:
compiler/src/gen/template/util.rs#L67
warning: length comparison to zero
--> compiler/src/gen/template/util.rs:67:8
|
67 | if value.len() == 0 {
| ^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `value.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
|
length comparison to zero:
compiler/src/gen/template/util.rs#L56
warning: length comparison to zero
--> compiler/src/gen/template/util.rs:56:8
|
56 | if value.len() == 0 {
| ^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `value.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
|
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 CaseConvention {
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
|
you are using an explicit closure for copying elements:
compiler/src/gen/template/functions.rs#L67
warning: you are using an explicit closure for copying elements
--> compiler/src/gen/template/functions.rs:67:9
|
67 | self.map.get(name).map(|v| *v)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `self.map.get(name).copied()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
|
deref on an immutable reference:
compiler/src/gen/template/core.rs#L151
warning: deref on an immutable reference
--> compiler/src/gen/template/core.rs:151:81
|
151 | ... .ok_or_else(|| Error::VariableNotFound(String::from(&*v.name)))?;
| ^^^^^^^^ help: if you would like to reborrow, try removing `&*`: `v.name`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref
|
length comparison to zero:
compiler/src/gen/rust/util.rs#L63
warning: length comparison to zero
--> compiler/src/gen/rust/util.rs:63:12
|
63 | if generics.len() > 0 {
| ^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!generics.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
|
match expression looks like `matches!` macro:
compiler/src/gen/rust/util.rs#L40
warning: match expression looks like `matches!` macro
--> compiler/src/gen/rust/util.rs:40:54
|
40 | let has_lifetime = msg.fields.iter().any(|v| match v.ty {
| ______________________________________________________^
41 | | FieldType::Ref(_) => true,
42 | | FieldType::NullTerminatedString => true,
43 | | FieldType::VarcharString(_) => true,
... |
48 | | _ => false,
49 | | });
| |_________^ help: try: `matches!(v.ty, FieldType::Ref(_) | FieldType::NullTerminatedString | FieldType::VarcharString(_) | FieldType::Array(_) | FieldType::Union(_) | FieldType::List(_) | FieldType::Payload)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
|
manual implementation of `Option::map`:
compiler/src/gen/rust/union.rs#L116
warning: manual implementation of `Option::map`
--> compiler/src/gen/rust/union.rs:116:17
|
116 | / match &case.item_type {
117 | | None => None,
118 | | Some(item_type) => Some(
119 | | scope
... |
123 | | ),
124 | | }
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
= note: `#[warn(clippy::manual_map)]` on by default
help: try
|
116 ~ case.item_type.as_ref().map(|item_type| scope
117 + .var("type_name", type_path_by_name.get(item_type.name()))
118 + .render("write_to.generics", &["case"])
119 + .unwrap())
|
|
comparison to empty slice:
compiler/src/gen/rust/union.rs#L109
warning: comparison to empty slice
--> compiler/src/gen/rust/union.rs:109:8
|
109 | if generics != "" {
| ^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!generics.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
|
comparison to empty slice:
compiler/src/gen/rust/union.rs#L94
warning: comparison to empty slice
--> compiler/src/gen/rust/union.rs:94:8
|
94 | if generics != "" {
| ^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!generics.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
= note: `#[warn(clippy::comparison_to_empty)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
compiler/src/gen/base/message_from_slice.rs#L145
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> compiler/src/gen/base/message_from_slice.rs:145:65
|
145 | .map(|field| gen_field_from_slice_impl::<U>(msg, field, &template, type_path_by_name))
| ^^^^^^^^^ help: change this to: `template`
|
= 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
|
deref which would be done by auto-deref:
compiler/src/gen/base/message_from_slice.rs#L41
warning: deref which would be done by auto-deref
--> compiler/src/gen/base/message_from_slice.rs:41:35
|
41 | U::gen_option_type_inline(&*type_name.into()).into()
| ^^^^^^^^^^^^^^^^^^ help: try: `&type_name.into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
= note: `#[warn(clippy::explicit_auto_deref)]` on by default
|
deref on an immutable reference:
compiler/src/compiler/util.rs#L68
warning: deref on an immutable reference
--> compiler/src/compiler/util.rs:68:38
|
68 | Some(v) => Cow::Borrowed(&*v),
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref
help: if you would like to reborrow, try removing `&*`
|
68 | Some(v) => Cow::Borrowed(v),
| ~
help: if you would like to deref, try using `&**`
|
68 | Some(v) => Cow::Borrowed(&**v),
| ~~~~
|
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 are using an explicit closure for copying elements:
compiler/src/compiler/union.rs#L144
warning: you are using an explicit closure for copying elements
--> compiler/src/compiler/union.rs:144:25
|
144 | leaf_index: index_list.last().map(|v| *v).unwrap(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `index_list.last().copied()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/union.rs#L65
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/union.rs:65:22
|
65 | .map(|v| Referenced::lookup(proto, &v).ok_or_else(|| Error::UndefinedReference(v)))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------------------------------------
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UndefinedReference(v))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
you are using an explicit closure for copying elements:
compiler/src/compiler/union.rs#L49
warning: you are using an explicit closure for copying elements
--> compiler/src/compiler/union.rs:49:35
|
49 | FieldView::Enum(v) => v
| ___________________________________^
50 | | .variants_map
51 | | .get(&value.case)
52 | | .map(|v| *v)
| |____________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
= note: `#[warn(clippy::map_clone)]` on by default
help: consider calling the dedicated `copied` method
|
49 ~ FieldView::Enum(v) => v
50 + .variants_map
51 + .get(&value.case).copied()
|
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/union.rs#L49
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/union.rs:49:35
|
49 | FieldView::Enum(v) => v
| ___________________________________^
50 | | .variants_map
51 | | .get(&value.case)
52 | | .map(|v| *v)
53 | | .ok_or_else(|| Error::InvalidUnionCase(value.case))?,
| |__________________-------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::InvalidUnionCase(value.case))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/structure.rs#L316
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/structure.rs:316:25
|
316 | let r = proto
| _________________________^
317 | | .structs_by_name
318 | | .get(&item_type)
319 | | .ok_or_else(|| Error::UndefinedReference(item_type))?;
| |______________________--------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UndefinedReference(item_type))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/structure.rs#L198
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/structure.rs:198:25
|
198 | let r = proto
| _________________________^
199 | | .enums_by_name
200 | | .get(&name)
201 | | .ok_or_else(|| Error::UndefinedReference(name))?;
| |______________________---------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UndefinedReference(name))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
match expression looks like `matches!` macro:
compiler/src/compiler/structure.rs#L180
warning: match expression looks like `matches!` macro
--> compiler/src/compiler/structure.rs:180:9
|
180 | / match self {
181 | | FieldView::Transmute => true,
182 | | FieldView::None => true,
183 | | _ => false,
184 | | }
| |_________^ help: try: `matches!(self, FieldView::Transmute | FieldView::None)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/structure.rs#L115
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/structure.rs:115:13
|
115 | / map_numeric(ty, Self::Int8, Self::UInt8, Self::Float32)
116 | | .ok_or_else(|| Error::UnsupportedType(motherfuckingrust))
| |__________________-------------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UnsupportedType(motherfuckingrust))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/structure.rs#L112
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/structure.rs:112:13
|
112 | / map_numeric(ty, Self::Int16, Self::UInt16, Self::Float32)
113 | | .ok_or_else(|| Error::UnsupportedType(motherfuckingrust))
| |__________________-------------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UnsupportedType(motherfuckingrust))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/structure.rs#L109
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/structure.rs:109:13
|
109 | / map_numeric(ty, Self::Int32, Self::UInt32, Self::Float64)
110 | | .ok_or_else(|| Error::UnsupportedType(motherfuckingrust))
| |__________________-------------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UnsupportedType(motherfuckingrust))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/structure.rs#L106
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/structure.rs:106:13
|
106 | / map_numeric(ty, Self::Int64, Self::UInt64, Self::Float64)
107 | | .ok_or_else(|| Error::UnsupportedType(motherfuckingrust))
| |__________________-------------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UnsupportedType(motherfuckingrust))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
this `match` can be collapsed into the outer `match`:
compiler/src/compiler/message.rs#L263
warning: this `match` can be collapsed into the outer `match`
--> compiler/src/compiler/message.rs:263:42
|
263 | FieldType::Ref(v) => match v {
| __________________________________________^
264 | | Referenced::Struct(v) => {
265 | | if !Rc::ptr_eq(&r.discriminant.root, v) {
266 | | return Err(Error::UnionTypeMismatch);
... |
269 | | _ => return Err(Error::UnionTypeMismatch),
270 | | },
| |_____________________^
|
help: the outer pattern can be modified to include the inner pattern
--> compiler/src/compiler/message.rs:263:36
|
263 | FieldType::Ref(v) => match v {
| ^ replace this binding
264 | Referenced::Struct(v) => {
| ^^^^^^^^^^^^^^^^^^^^^ with this pattern
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match
= note: `#[warn(clippy::collapsible_match)]` on by default
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/message.rs#L258
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/message.rs:258:25
|
258 | let r = proto
| _________________________^
259 | | .unions_by_name
260 | | .get(&item_type)
261 | | .ok_or_else(|| Error::UndefinedReference(item_type))?;
| |______________________--------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UndefinedReference(item_type))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/message.rs#L253
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/message.rs:253:44
|
253 | let (on_index, on_field) = unsorted
| ____________________________________________^
254 | | .iter()
255 | | .enumerate()
256 | | .find_map(|(k, v)| if v.name == on { Some((k, v)) } else { None })
257 | | .ok_or_else(|| Error::UndefinedReference(on))?;
| |______________________-------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UndefinedReference(on))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/message.rs#L198
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/message.rs:198:25
|
198 | let r = Referenced::lookup(proto, &item_type)
| _________________________^
199 | | .ok_or_else(|| Error::UndefinedReference(item_type))?;
| |______________________--------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UndefinedReference(item_type))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/message.rs#L149
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/message.rs:149:25
|
149 | let r = Referenced::lookup(proto, &item_type)
| _________________________^
150 | | .ok_or_else(|| Error::UndefinedReference(item_type))?;
| |______________________--------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UndefinedReference(item_type))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
= note: `#[warn(clippy::unnecessary_lazy_evaluations)]` on by default
|
match expression looks like `matches!` macro:
compiler/src/compiler/message.rs#L119
warning: match expression looks like `matches!` macro
--> compiler/src/compiler/message.rs:119:9
|
119 | / match self {
120 | | FieldType::VarcharString(_) | FieldType::NullTerminatedString => true,
121 | | _ => false
122 | | }
| |_________^ help: try: `matches!(self, FieldType::VarcharString(_) | FieldType::NullTerminatedString)`
|
= 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
|
doc list item missing indentation:
compiler/src/build_script.rs#L38
warning: doc list item missing indentation
--> compiler/src/build_script.rs:38:5
|
38 | /// Rust code for.
| ^
|
= help: if this is supposed to be its own paragraph, add a blank line
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
= note: `#[warn(clippy::doc_lazy_continuation)]` on by default
help: indent this line
|
38 | /// Rust code for.
| ++
|
unneeded late initialization:
compiler/src/interface.rs#L177
warning: unneeded late initialization
--> compiler/src/interface.rs:177:13
|
177 | let proto_path;
| ^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init
= note: `#[warn(clippy::needless_late_init)]` on by default
help: move the declaration `proto_path` here and remove the assignments from the branches
|
177 ~
178 ~ let proto_path = if umbrella.len() > 1 {
179 | let umbrella_path = out_path.join("umbrella.rs");
180 | std::fs::write(&umbrella_path, umbrella).map_err(Error::Io)?;
181 ~ umbrella_path
182 | } else {
183 ~ out_path
184 ~ };
|
|
manual implementation of `Option::map`:
compiler/src/interface.rs#L167
warning: manual implementation of `Option::map`
--> compiler/src/interface.rs:167:30
|
167 | Ok(o) => match o {
| ______________________________^
168 | | Some(o) => Some(Ok(o)),
169 | | None => None,
170 | | },
| |_____________________^ help: try: `o.map(Ok)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
|
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 + }
|
|
useless use of `format!`:
compiler/src/gen/template/util.rs#L133
warning: useless use of `format!`
--> compiler/src/gen/template/util.rs:133:9
|
133 | / format!(
134 | | "{}",
135 | | regex.find_iter(self.0).map(|v| v.as_str().to_uppercase()).join("_")
136 | | )
| |_________^ help: consider using `.to_string()`: `regex.find_iter(self.0).map(|v| v.as_str().to_uppercase()).join("_").to_string()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format
|
useless use of `format!`:
compiler/src/gen/template/util.rs#L119
warning: useless use of `format!`
--> compiler/src/gen/template/util.rs:119:9
|
119 | / format!(
120 | | "{}",
121 | | regex.find_iter(self.0).map(|v| v.as_str().to_lowercase()).join("_")
122 | | )
| |_________^ help: consider using `.to_string()`: `regex.find_iter(self.0).map(|v| v.as_str().to_lowercase()).join("_").to_string()`
|
= 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
|
length comparison to zero:
compiler/src/gen/template/util.rs#L67
warning: length comparison to zero
--> compiler/src/gen/template/util.rs:67:8
|
67 | if value.len() == 0 {
| ^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `value.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
|
length comparison to zero:
compiler/src/gen/template/util.rs#L56
warning: length comparison to zero
--> compiler/src/gen/template/util.rs:56:8
|
56 | if value.len() == 0 {
| ^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `value.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
|
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 CaseConvention {
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
|
you are using an explicit closure for copying elements:
compiler/src/gen/template/functions.rs#L67
warning: you are using an explicit closure for copying elements
--> compiler/src/gen/template/functions.rs:67:9
|
67 | self.map.get(name).map(|v| *v)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `self.map.get(name).copied()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
|
deref on an immutable reference:
compiler/src/gen/template/core.rs#L151
warning: deref on an immutable reference
--> compiler/src/gen/template/core.rs:151:81
|
151 | ... .ok_or_else(|| Error::VariableNotFound(String::from(&*v.name)))?;
| ^^^^^^^^ help: if you would like to reborrow, try removing `&*`: `v.name`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref
|
length comparison to zero:
compiler/src/gen/rust/util.rs#L63
warning: length comparison to zero
--> compiler/src/gen/rust/util.rs:63:12
|
63 | if generics.len() > 0 {
| ^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!generics.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
|
match expression looks like `matches!` macro:
compiler/src/gen/rust/util.rs#L40
warning: match expression looks like `matches!` macro
--> compiler/src/gen/rust/util.rs:40:54
|
40 | let has_lifetime = msg.fields.iter().any(|v| match v.ty {
| ______________________________________________________^
41 | | FieldType::Ref(_) => true,
42 | | FieldType::NullTerminatedString => true,
43 | | FieldType::VarcharString(_) => true,
... |
48 | | _ => false,
49 | | });
| |_________^ help: try: `matches!(v.ty, FieldType::Ref(_) | FieldType::NullTerminatedString | FieldType::VarcharString(_) | FieldType::Array(_) | FieldType::Union(_) | FieldType::List(_) | FieldType::Payload)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
|
manual implementation of `Option::map`:
compiler/src/gen/rust/union.rs#L116
warning: manual implementation of `Option::map`
--> compiler/src/gen/rust/union.rs:116:17
|
116 | / match &case.item_type {
117 | | None => None,
118 | | Some(item_type) => Some(
119 | | scope
... |
123 | | ),
124 | | }
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map
= note: `#[warn(clippy::manual_map)]` on by default
help: try
|
116 ~ case.item_type.as_ref().map(|item_type| scope
117 + .var("type_name", type_path_by_name.get(item_type.name()))
118 + .render("write_to.generics", &["case"])
119 + .unwrap())
|
|
comparison to empty slice:
compiler/src/gen/rust/union.rs#L109
warning: comparison to empty slice
--> compiler/src/gen/rust/union.rs:109:8
|
109 | if generics != "" {
| ^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!generics.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
|
comparison to empty slice:
compiler/src/gen/rust/union.rs#L94
warning: comparison to empty slice
--> compiler/src/gen/rust/union.rs:94:8
|
94 | if generics != "" {
| ^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!generics.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
= note: `#[warn(clippy::comparison_to_empty)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
compiler/src/gen/base/message_from_slice.rs#L145
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> compiler/src/gen/base/message_from_slice.rs:145:65
|
145 | .map(|field| gen_field_from_slice_impl::<U>(msg, field, &template, type_path_by_name))
| ^^^^^^^^^ help: change this to: `template`
|
= 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
|
deref which would be done by auto-deref:
compiler/src/gen/base/message_from_slice.rs#L41
warning: deref which would be done by auto-deref
--> compiler/src/gen/base/message_from_slice.rs:41:35
|
41 | U::gen_option_type_inline(&*type_name.into()).into()
| ^^^^^^^^^^^^^^^^^^ help: try: `&type_name.into()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
= note: `#[warn(clippy::explicit_auto_deref)]` on by default
|
deref on an immutable reference:
compiler/src/compiler/util.rs#L68
warning: deref on an immutable reference
--> compiler/src/compiler/util.rs:68:38
|
68 | Some(v) => Cow::Borrowed(&*v),
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref
help: if you would like to reborrow, try removing `&*`
|
68 | Some(v) => Cow::Borrowed(v),
| ~
help: if you would like to deref, try using `&**`
|
68 | Some(v) => Cow::Borrowed(&**v),
| ~~~~
|
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 are using an explicit closure for copying elements:
compiler/src/compiler/union.rs#L144
warning: you are using an explicit closure for copying elements
--> compiler/src/compiler/union.rs:144:25
|
144 | leaf_index: index_list.last().map(|v| *v).unwrap(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `index_list.last().copied()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/union.rs#L65
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/union.rs:65:22
|
65 | .map(|v| Referenced::lookup(proto, &v).ok_or_else(|| Error::UndefinedReference(v)))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------------------------------------
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UndefinedReference(v))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
you are using an explicit closure for copying elements:
compiler/src/compiler/union.rs#L49
warning: you are using an explicit closure for copying elements
--> compiler/src/compiler/union.rs:49:35
|
49 | FieldView::Enum(v) => v
| ___________________________________^
50 | | .variants_map
51 | | .get(&value.case)
52 | | .map(|v| *v)
| |____________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
= note: `#[warn(clippy::map_clone)]` on by default
help: consider calling the dedicated `copied` method
|
49 ~ FieldView::Enum(v) => v
50 + .variants_map
51 + .get(&value.case).copied()
|
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/union.rs#L49
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/union.rs:49:35
|
49 | FieldView::Enum(v) => v
| ___________________________________^
50 | | .variants_map
51 | | .get(&value.case)
52 | | .map(|v| *v)
53 | | .ok_or_else(|| Error::InvalidUnionCase(value.case))?,
| |__________________-------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::InvalidUnionCase(value.case))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/structure.rs#L316
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/structure.rs:316:25
|
316 | let r = proto
| _________________________^
317 | | .structs_by_name
318 | | .get(&item_type)
319 | | .ok_or_else(|| Error::UndefinedReference(item_type))?;
| |______________________--------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UndefinedReference(item_type))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/structure.rs#L198
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/structure.rs:198:25
|
198 | let r = proto
| _________________________^
199 | | .enums_by_name
200 | | .get(&name)
201 | | .ok_or_else(|| Error::UndefinedReference(name))?;
| |______________________---------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UndefinedReference(name))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
match expression looks like `matches!` macro:
compiler/src/compiler/structure.rs#L180
warning: match expression looks like `matches!` macro
--> compiler/src/compiler/structure.rs:180:9
|
180 | / match self {
181 | | FieldView::Transmute => true,
182 | | FieldView::None => true,
183 | | _ => false,
184 | | }
| |_________^ help: try: `matches!(self, FieldView::Transmute | FieldView::None)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/structure.rs#L115
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/structure.rs:115:13
|
115 | / map_numeric(ty, Self::Int8, Self::UInt8, Self::Float32)
116 | | .ok_or_else(|| Error::UnsupportedType(motherfuckingrust))
| |__________________-------------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UnsupportedType(motherfuckingrust))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/structure.rs#L112
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/structure.rs:112:13
|
112 | / map_numeric(ty, Self::Int16, Self::UInt16, Self::Float32)
113 | | .ok_or_else(|| Error::UnsupportedType(motherfuckingrust))
| |__________________-------------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UnsupportedType(motherfuckingrust))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/structure.rs#L109
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/structure.rs:109:13
|
109 | / map_numeric(ty, Self::Int32, Self::UInt32, Self::Float64)
110 | | .ok_or_else(|| Error::UnsupportedType(motherfuckingrust))
| |__________________-------------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UnsupportedType(motherfuckingrust))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/structure.rs#L106
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/structure.rs:106:13
|
106 | / map_numeric(ty, Self::Int64, Self::UInt64, Self::Float64)
107 | | .ok_or_else(|| Error::UnsupportedType(motherfuckingrust))
| |__________________-------------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UnsupportedType(motherfuckingrust))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
this `match` can be collapsed into the outer `match`:
compiler/src/compiler/message.rs#L263
warning: this `match` can be collapsed into the outer `match`
--> compiler/src/compiler/message.rs:263:42
|
263 | FieldType::Ref(v) => match v {
| __________________________________________^
264 | | Referenced::Struct(v) => {
265 | | if !Rc::ptr_eq(&r.discriminant.root, v) {
266 | | return Err(Error::UnionTypeMismatch);
... |
269 | | _ => return Err(Error::UnionTypeMismatch),
270 | | },
| |_____________________^
|
help: the outer pattern can be modified to include the inner pattern
--> compiler/src/compiler/message.rs:263:36
|
263 | FieldType::Ref(v) => match v {
| ^ replace this binding
264 | Referenced::Struct(v) => {
| ^^^^^^^^^^^^^^^^^^^^^ with this pattern
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match
= note: `#[warn(clippy::collapsible_match)]` on by default
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/message.rs#L258
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/message.rs:258:25
|
258 | let r = proto
| _________________________^
259 | | .unions_by_name
260 | | .get(&item_type)
261 | | .ok_or_else(|| Error::UndefinedReference(item_type))?;
| |______________________--------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UndefinedReference(item_type))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/message.rs#L253
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/message.rs:253:44
|
253 | let (on_index, on_field) = unsorted
| ____________________________________________^
254 | | .iter()
255 | | .enumerate()
256 | | .find_map(|(k, v)| if v.name == on { Some((k, v)) } else { None })
257 | | .ok_or_else(|| Error::UndefinedReference(on))?;
| |______________________-------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UndefinedReference(on))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/message.rs#L198
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/message.rs:198:25
|
198 | let r = Referenced::lookup(proto, &item_type)
| _________________________^
199 | | .ok_or_else(|| Error::UndefinedReference(item_type))?;
| |______________________--------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UndefinedReference(item_type))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
|
unnecessary closure used to substitute value for `Option::None`:
compiler/src/compiler/message.rs#L149
warning: unnecessary closure used to substitute value for `Option::None`
--> compiler/src/compiler/message.rs:149:25
|
149 | let r = Referenced::lookup(proto, &item_type)
| _________________________^
150 | | .ok_or_else(|| Error::UndefinedReference(item_type))?;
| |______________________--------------------------------------------------^
| |
| help: use `ok_or(..)` instead: `ok_or(Error::UndefinedReference(item_type))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
= note: `#[warn(clippy::unnecessary_lazy_evaluations)]` on by default
|
match expression looks like `matches!` macro:
compiler/src/compiler/message.rs#L119
warning: match expression looks like `matches!` macro
--> compiler/src/compiler/message.rs:119:9
|
119 | / match self {
120 | | FieldType::VarcharString(_) | FieldType::NullTerminatedString => true,
121 | | _ => false
122 | | }
| |_________^ help: try: `matches!(self, FieldType::VarcharString(_) | FieldType::NullTerminatedString)`
|
= 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
|
doc list item missing indentation:
compiler/src/build_script.rs#L38
warning: doc list item missing indentation
--> compiler/src/build_script.rs:38:5
|
38 | /// Rust code for.
| ^
|
= help: if this is supposed to be its own paragraph, add a blank line
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
= note: `#[warn(clippy::doc_lazy_continuation)]` on by default
help: indent this line
|
38 | /// Rust code for.
| ++
|
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: 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/codec/bytes.rs#L50
warning: unsafe function's docs miss `# Safety` section
--> runtime/src/codec/bytes.rs:50:5
|
50 | unsafe fn write_unaligned<T: WriteBytes>(buffer: &mut [u8], value: T) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc
|
unsafe function's docs miss `# Safety` section:
runtime/src/codec/bytes.rs#L48
warning: unsafe function's docs miss `# Safety` section
--> runtime/src/codec/bytes.rs:48:5
|
48 | unsafe fn write_aligned<T: WriteBytes>(buffer: &mut [u8], value: T);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc
|
unsafe function's docs miss `# Safety` section:
runtime/src/codec/bytes.rs#L34
warning: unsafe function's docs miss `# Safety` section
--> runtime/src/codec/bytes.rs:34:5
|
34 | unsafe fn read_unaligned<T: ReadBytes>(buffer: &[u8]) -> T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc
|
unsafe function's docs miss `# Safety` section:
runtime/src/codec/bytes.rs#L32
warning: unsafe function's docs miss `# Safety` section
--> runtime/src/codec/bytes.rs:32:5
|
32 | unsafe fn read_aligned<T: ReadBytes>(buffer: &[u8]) -> T;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc
|
unsafe function's docs miss `# Safety` section:
runtime/src/codec/bits.rs#L83
warning: unsafe function's docs miss `# Safety` section
--> runtime/src/codec/bits.rs:83:5
|
83 | / unsafe fn write_unaligned<
84 | | T: ToUsize
85 | | + ReadBytes
86 | | + WriteBytes
... |
95 | | value: T,
96 | | ) {
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc
|
unsafe function's docs miss `# Safety` section:
runtime/src/codec/bits.rs#L68
warning: unsafe function's docs miss `# Safety` section
--> runtime/src/codec/bits.rs:68:5
|
68 | / unsafe fn write_aligned<
69 | | T: ToUsize
70 | | + ReadBytes
71 | | + WriteBytes
... |
80 | | value: T,
81 | | );
| |______^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc
|
unsafe function's docs miss `# Safety` section:
runtime/src/codec/bits.rs#L42
warning: unsafe function's docs miss `# Safety` section
--> runtime/src/codec/bits.rs:42:5
|
42 | / unsafe fn read_unaligned<
43 | | T: ToUsize + ReadBytes + Shr<Output = T> + BitAnd<Output = T>,
44 | | const BIT_OFFSET: usize,
45 | | const BIT_SIZE: usize,
46 | | >(
47 | | buffer: &[u8],
48 | | ) -> T {
| |__________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc
|
unsafe function's docs miss `# Safety` section:
runtime/src/codec/bits.rs#L34
warning: unsafe function's docs miss `# Safety` section
--> runtime/src/codec/bits.rs:34:5
|
34 | / unsafe fn read_aligned<
35 | | T: ToUsize + ReadBytes + Shr<Output = T> + BitAnd<Output = T>,
36 | | const BIT_OFFSET: usize,
37 | | const BIT_SIZE: usize,
38 | | >(
39 | | buffer: &[u8],
40 | | ) -> T;
| |___________^
|
= 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
|
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
|