Skip to content

Merge remote-tracking branch 'origin/develop' into develop #22

Merge remote-tracking branch 'origin/develop' into develop

Merge remote-tracking branch 'origin/develop' into develop #22

Triggered via push August 13, 2024 12:35
Status Failure
Total duration 2m 21s
Artifacts

development.yml

on: push
Matrix: Test / Build & Test
Matrix: Coverage / Coverage
Analyze  /  Check | Clippy
29s
Analyze / Check | Clippy
Analyze  /  Check | Audit
15s
Analyze / Check | Audit
Release  /  Get Version
6s
Release / Get Version
Analyze  /  Format Code
11s
Analyze / Format Code
Release  /  Create Pre Release
0s
Release / Create Pre Release
Release  /  Create Release Pull Request
0s
Release / Create Release Pull Request
Fit to window
Zoom out
Zoom in

Annotations

3 errors and 188 warnings
Coverage / Coverage (macos-12)
Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
Coverage / Coverage (windows-2019)
The job was canceled because "macos-12" failed.
Coverage / Coverage (windows-2019)
The operation was canceled.
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
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
manual implementation of `Option::map`: compiler/src/gen/base/union.rs#L86
warning: manual implementation of `Option::map` --> compiler/src/gen/base/union.rs:86:17 | 86 | / match &case.item_type { 87 | | None => None, 88 | | Some(item_type) => Some( 89 | | scope ... | 93 | | ), 94 | | } | |_________________^ | = 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 | 86 ~ case.item_type.as_ref().map(|item_type| scope 87 + .var("type_name", type_path_by_name.get(item_type.name())) 88 + .render("write_to.generics", &["case"]) 89 + .unwrap()) |
comparison to empty slice: compiler/src/gen/base/union.rs#L79
warning: comparison to empty slice --> compiler/src/gen/base/union.rs:79:8 | 79 | 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/base/union.rs#L64
warning: comparison to empty slice --> compiler/src/gen/base/union.rs:64:8 | 64 | 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
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
this expression creates a reference which is immediately dereferenced by the compiler: compiler/src/gen/base/message_from_slice.rs#L144
warning: this expression creates a reference which is immediately dereferenced by the compiler --> compiler/src/gen/base/message_from_slice.rs:144:65 | 144 | .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
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 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/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
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
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
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
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
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
manual implementation of `Option::map`: compiler/src/gen/base/union.rs#L86
warning: manual implementation of `Option::map` --> compiler/src/gen/base/union.rs:86:17 | 86 | / match &case.item_type { 87 | | None => None, 88 | | Some(item_type) => Some( 89 | | scope ... | 93 | | ), 94 | | } | |_________________^ | = 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 | 86 ~ case.item_type.as_ref().map(|item_type| scope 87 + .var("type_name", type_path_by_name.get(item_type.name())) 88 + .render("write_to.generics", &["case"]) 89 + .unwrap()) |
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
comparison to empty slice: compiler/src/gen/base/union.rs#L79
warning: comparison to empty slice --> compiler/src/gen/base/union.rs:79:8 | 79 | 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/base/union.rs#L64
warning: comparison to empty slice --> compiler/src/gen/base/union.rs:64:8 | 64 | 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#L144
warning: this expression creates a reference which is immediately dereferenced by the compiler --> compiler/src/gen/base/message_from_slice.rs:144:65 | 144 | .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
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
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
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
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), | ~~~~
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
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
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
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
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
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
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
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
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
manual implementation of `Option::map`: compiler/src/gen/base/union.rs#L86
warning: manual implementation of `Option::map` --> compiler/src/gen/base/union.rs:86:17 | 86 | / match &case.item_type { 87 | | None => None, 88 | | Some(item_type) => Some( 89 | | scope ... | 93 | | ), 94 | | } | |_________________^ | = 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 | 86 ~ case.item_type.as_ref().map(|item_type| scope 87 + .var("type_name", type_path_by_name.get(item_type.name())) 88 + .render("write_to.generics", &["case"]) 89 + .unwrap()) |
comparison to empty slice: compiler/src/gen/base/union.rs#L79
warning: comparison to empty slice --> compiler/src/gen/base/union.rs:79:8 | 79 | 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/base/union.rs#L64
warning: comparison to empty slice --> compiler/src/gen/base/union.rs:64:8 | 64 | 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
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
this expression creates a reference which is immediately dereferenced by the compiler: compiler/src/gen/base/message_from_slice.rs#L144
warning: this expression creates a reference which is immediately dereferenced by the compiler --> compiler/src/gen/base/message_from_slice.rs:144:65 | 144 | .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
manual implementation of `Option::map`: compiler/src/gen/base/union.rs#L86
warning: manual implementation of `Option::map` --> compiler/src/gen/base/union.rs:86:17 | 86 | / match &case.item_type { 87 | | None => None, 88 | | Some(item_type) => Some( 89 | | scope ... | 93 | | ), 94 | | } | |_________________^ | = 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 | 86 ~ case.item_type.as_ref().map(|item_type| scope 87 + .var("type_name", type_path_by_name.get(item_type.name())) 88 + .render("write_to.generics", &["case"]) 89 + .unwrap()) |
comparison to empty slice: compiler/src/gen/base/union.rs#L79
warning: comparison to empty slice --> compiler/src/gen/base/union.rs:79:8 | 79 | 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/base/union.rs#L64
warning: comparison to empty slice --> compiler/src/gen/base/union.rs:64:8 | 64 | 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
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
this expression creates a reference which is immediately dereferenced by the compiler: compiler/src/gen/base/message_from_slice.rs#L144
warning: this expression creates a reference which is immediately dereferenced by the compiler --> compiler/src/gen/base/message_from_slice.rs:144:65 | 144 | .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
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
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 + } |
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
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#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#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#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
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
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#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#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#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
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
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
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