use cargo workspace #389
clippy
63 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 63 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.79.0 (129f3b996 2024-06-10)
- cargo 1.79.0 (ffa9cf99a 2024-06-03)
- clippy 0.1.79 (129f3b9 2024-06-10)
Annotations
Check warning on line 112 in crates/specta-zod/src/lib.rs
github-actions / clippy
this expression always evaluates to true
warning: this expression always evaluates to true
--> crates/specta-zod/src/lib.rs:112:47
|
112 | let prefix = match start_with_newline && !comments.is_empty() {
| ^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#const_is_empty
= note: `#[warn(clippy::const_is_empty)]` on by default
Check warning on line 8 in crates/specta-zod/src/context.rs
github-actions / clippy
field `0` is never read
warning: field `0` is never read
--> crates/specta-zod/src/context.rs:8:18
|
8 | TypeExtended(Cow<'static, str>, ImplLocation),
| ------------ ^^^^^^^^^^^^^^^^^
| |
| field in this variant
|
= note: `#[warn(dead_code)]` on by default
help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
|
8 | TypeExtended((), ImplLocation),
| ~~
Check warning on line 36 in crates/specta/src/type_collection.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> crates/specta/src/type_collection.rs:36:29
|
36 | let dt = export(&mut type_map);
| ^^^^^^^^^^^^^ help: change this to: `type_map`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: `#[warn(clippy::needless_borrow)]` implied by `#[warn(clippy::all)]`
Check warning on line 17 in crates/specta/src/type_collection.rs
github-actions / clippy
this `impl` can be derived
warning: this `impl` can be derived
--> crates/specta/src/type_collection.rs:11:1
|
11 | / impl Default for TypeCollection {
12 | | fn default() -> Self {
13 | | Self {
14 | | types: HashMap::new(),
15 | | }
16 | | }
17 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= note: `#[warn(clippy::derivable_impls)]` implied by `#[warn(clippy::all)]`
= help: remove the manual implementation...
help: ...and instead derive it
|
7 + #[derive(Default)]
8 | pub struct TypeCollection {
|
Check warning on line 241 in crates/specta-macros/src/type/generics.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> crates/specta-macros/src/type/generics.rs:241:29
|
241 | let generics = generics(&crate_ref, quote!(&[#(#generic_var_idents),*]));
| ^^^^^^^^^^ help: change this to: `crate_ref`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 192 in crates/specta-macros/src/type/generics.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> crates/specta-macros/src/type/generics.rs:192:17
|
192 | &crate_ref,
| ^^^^^^^^^^ help: change this to: `crate_ref`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 169 in crates/specta-macros/src/type/generics.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> crates/specta-macros/src/type/generics.rs:169:37
|
169 | let generics = generics(&crate_ref, quote!(&[]));
| ^^^^^^^^^^ help: change this to: `crate_ref`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 151 in crates/specta-macros/src/type/generics.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> crates/specta-macros/src/type/generics.rs:151:37
|
151 | let generics = generics(&crate_ref, quote!(&[#elem_var_ident]));
| ^^^^^^^^^^ help: change this to: `crate_ref`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check warning on line 131 in crates/specta-macros/src/type/generics.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> crates/specta-macros/src/type/generics.rs:131:37
|
131 | let generics = generics(&crate_ref, quote!(&[#(#generic_var_idents),*]));
| ^^^^^^^^^^ help: change this to: `crate_ref`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: `#[warn(clippy::needless_borrow)]` on by default
Check warning on line 166 in crates/specta/src/type/impls.rs
github-actions / clippy
accessing first element with `generics.get(0)`
warning: accessing first element with `generics.get(0)`
--> crates/specta/src/type/impls.rs:165:17
|
165 | / generics
166 | | .get(0)
| |___________________________^ help: try: `generics.first()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
Check warning on line 153 in crates/specta/src/type/impls.rs
github-actions / clippy
accessing first element with `generics.get(0)`
warning: accessing first element with `generics.get(0)`
--> crates/specta/src/type/impls.rs:153:18
|
153 | ty = generics.get(0).cloned()
| ^^^^^^^^^^^^^^^ help: try: `generics.first()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
= note: `#[warn(clippy::get_first)]` implied by `#[warn(clippy::all)]`
Check warning on line 32 in crates/specta-macros/src/type/attr/variant.rs
github-actions / clippy
field assignment outside of initializer for an instance created with Default::default()
warning: field assignment outside of initializer for an instance created with Default::default()
--> crates/specta-macros/src/type/attr/variant.rs:32:9
|
32 | result.common = CommonAttr::from_attrs(attrs)?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `r#type::attr::variant::VariantAttr { common: CommonAttr::from_attrs(attrs)?, ..Default::default() }` and removing relevant reassignments
--> crates/specta-macros/src/type/attr/variant.rs:31:9
|
31 | let mut result = Self::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
Check warning on line 218 in crates/specta-macros/src/utils.rs
github-actions / clippy
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> crates/specta-macros/src/utils.rs:218:24
|
218 | attrs: &mut Vec<crate::utils::Attribute>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
|
::: crates/specta-macros/src/type/attr/variant.rs:18:1
|
18 | / impl_parse! {
19 | | VariantAttr(attr, out) {
20 | | "rename_all" => out.rename_all = out.rename_all.take().or(Some(attr.parse_inflection()?)),
21 | | "rename" => out.rename = out.rename.take().or(Some(attr.parse_string()?.to_token_stream())),
... |
26 | | }
27 | | }
| |_- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: this warning originates in the macro `impl_parse` (in Nightly builds, run with -Z macro-backtrace for more info)
Check warning on line 54 in crates/specta-macros/src/type/attr/field.rs
github-actions / clippy
field assignment outside of initializer for an instance created with Default::default()
warning: field assignment outside of initializer for an instance created with Default::default()
--> crates/specta-macros/src/type/attr/field.rs:54:9
|
54 | result.common = CommonAttr::from_attrs(attrs)?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `r#type::attr::field::FieldAttr { common: CommonAttr::from_attrs(attrs)?, ..Default::default() }` and removing relevant reassignments
--> crates/specta-macros/src/type/attr/field.rs:53:9
|
53 | let mut result = Self::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
Check warning on line 218 in crates/specta-macros/src/utils.rs
github-actions / clippy
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> crates/specta-macros/src/utils.rs:218:24
|
218 | attrs: &mut Vec<crate::utils::Attribute>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
|
::: crates/specta-macros/src/type/attr/field.rs:20:1
|
20 | / impl_parse! {
21 | | FieldAttr(attr, out) {
22 | | "rename" => {
23 | | let attr = attr.parse_string()?;
... |
48 | | }
49 | | }
| |_- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: this warning originates in the macro `impl_parse` (in Nightly builds, run with -Z macro-backtrace for more info)
Check warning on line 218 in crates/specta-macros/src/utils.rs
github-actions / clippy
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> crates/specta-macros/src/utils.rs:218:24
|
218 | attrs: &mut Vec<crate::utils::Attribute>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
|
::: crates/specta-macros/src/type/attr/enum.rs:25:1
|
25 | / impl_parse! {
26 | | EnumAttr(attr, out) {
27 | | // "tag" was already passed in the container so we don't need to do anything here
28 | | "content" => out.content = out.content.take().or(Some(attr.parse_string()?)),
... |
31 | | }
32 | | }
| |_- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: this warning originates in the macro `impl_parse` (in Nightly builds, run with -Z macro-backtrace for more info)
Check warning on line 54 in crates/specta-macros/src/type/attr/container.rs
github-actions / clippy
field assignment outside of initializer for an instance created with Default::default()
warning: field assignment outside of initializer for an instance created with Default::default()
--> crates/specta-macros/src/type/attr/container.rs:54:9
|
54 | result.common = CommonAttr::from_attrs(attrs)?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: consider initializing the variable with `r#type::attr::container::ContainerAttr { common: CommonAttr::from_attrs(attrs)?, ..Default::default() }` and removing relevant reassignments
--> crates/specta-macros/src/type/attr/container.rs:53:9
|
53 | let mut result = Self::default();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
= note: `#[warn(clippy::field_reassign_with_default)]` on by default
Check warning on line 218 in crates/specta-macros/src/utils.rs
github-actions / clippy
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> crates/specta-macros/src/utils.rs:218:24
|
218 | attrs: &mut Vec<crate::utils::Attribute>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
|
::: crates/specta-macros/src/type/attr/container.rs:24:1
|
24 | / impl_parse! {
25 | | ContainerAttr(attr, out) {
26 | | "rename_all" => out.rename_all = out.rename_all.take().or(Some(attr.parse_inflection()?)),
27 | | "rename" => {
... |
48 | | }
49 | | }
| |_- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: this warning originates in the macro `impl_parse` (in Nightly builds, run with -Z macro-backtrace for more info)
Check warning on line 78 in crates/specta-macros/src/type/attr/common.rs
github-actions / clippy
called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
--> crates/specta-macros/src/type/attr/common.rs:75:32
|
75 | let note = attr
| ________________________________^
76 | | .iter()
77 | | .filter(|attr| attr.key == "note")
78 | | .next()
| |_______________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#filter_next
help: try
|
75 ~ let note = attr
76 + .iter().find(|attr| attr.key == "note")
|
Check warning on line 64 in crates/specta-macros/src/type/attr/common.rs
github-actions / clippy
called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
--> crates/specta-macros/src/type/attr/common.rs:61:33
|
61 | let since = attr
| _________________________________^
62 | | .iter()
63 | | .filter(|attr| attr.key == "since")
64 | | .next()
| |_______________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#filter_next
help: try
|
61 ~ let since = attr
62 + .iter().find(|attr| attr.key == "since")
|
Check warning on line 46 in crates/specta-macros/src/type/attr/common.rs
github-actions / clippy
called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
--> crates/specta-macros/src/type/attr/common.rs:46:35
|
46 | if let Some(attr_value) = attrs.iter().filter(|attr| attr.key == "deprecated").next() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `attrs.iter().find(|attr| attr.key == "deprecated")`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#filter_next
= note: `#[warn(clippy::filter_next)]` on by default
Check warning on line 38 in crates/specta-macros/src/type/attr/common.rs
github-actions / clippy
calling `push_str()` using a single-character string literal
warning: calling `push_str()` using a single-character string literal
--> crates/specta-macros/src/type/attr/common.rs:38:21
|
38 | s.push_str("\n");
| ^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `s.push('\n')`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_add_str
= note: `#[warn(clippy::single_char_add_str)]` on by default
Check warning on line 32 in crates/specta-macros/src/type/attr/common.rs
github-actions / clippy
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> crates/specta-macros/src/type/attr/common.rs:32:30
|
32 | pub fn from_attrs(attrs: &mut Vec<Attribute>) -> Result<Self> {
| ^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [Attribute]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
Check warning on line 40 in crates/specta-macros/src/specta.rs
github-actions / clippy
redundant pattern matching, consider using `is_some()`
warning: redundant pattern matching, consider using `is_some()`
--> crates/specta-macros/src/specta.rs:37:30
|
37 | let function_asyncness = match function.sig.asyncness {
| ______________________________^
38 | | Some(_) => true,
39 | | None => false,
40 | | };
| |_____^ help: try: `function.sig.asyncness.is_some()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
= note: `#[warn(clippy::redundant_pattern_matching)]` on by default
Check warning on line 24 in crates/specta-macros/src/data_type_from/mod.rs
github-actions / clippy
length comparison to zero
warning: length comparison to zero
--> crates/specta-macros/src/data_type_from/mod.rs:24:8
|
24 | if generics.params.len() > 0 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!generics.params.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