use cargo workspace #389
Annotations
5 errors and 65 warnings
build (macos-latest)
Process completed with exit code 101.
|
build (windows-latest)
The job was canceled because "macos-latest" failed.
|
build (windows-latest)
The operation was canceled.
|
build (ubuntu-latest)
The job was canceled because "macos-latest" failed.
|
build (ubuntu-latest)
The operation was canceled.
|
this expression always evaluates to true:
crates/specta-zod/src/lib.rs#L112
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
|
field `0` is never read:
crates/specta-zod/src/context.rs#L8
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),
| ~~
|
this expression creates a reference which is immediately dereferenced by the compiler:
crates/specta/src/type_collection.rs#L36
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)]`
|
this `impl` can be derived:
crates/specta/src/type_collection.rs#L11
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 {
|
|
this expression creates a reference which is immediately dereferenced by the compiler:
crates/specta-macros/src/type/generics.rs#L241
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
|
this expression creates a reference which is immediately dereferenced by the compiler:
crates/specta-macros/src/type/generics.rs#L192
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
|
this expression creates a reference which is immediately dereferenced by the compiler:
crates/specta-macros/src/type/generics.rs#L169
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
|
this expression creates a reference which is immediately dereferenced by the compiler:
crates/specta-macros/src/type/generics.rs#L151
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
|
this expression creates a reference which is immediately dereferenced by the compiler:
crates/specta-macros/src/type/generics.rs#L131
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
|
accessing first element with `generics.get(0)`:
crates/specta/src/type/impls.rs#L165
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
|
accessing first element with `generics.get(0)`:
crates/specta/src/type/impls.rs#L153
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)]`
|
field assignment outside of initializer for an instance created with Default::default():
crates/specta-macros/src/type/attr/variant.rs#L32
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
|
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do:
crates/specta-macros/src/utils.rs#L218
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)
|
field assignment outside of initializer for an instance created with Default::default():
crates/specta-macros/src/type/attr/field.rs#L54
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
|
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do:
crates/specta-macros/src/utils.rs#L218
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)
|
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do:
crates/specta-macros/src/utils.rs#L218
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)
|
field assignment outside of initializer for an instance created with Default::default():
crates/specta-macros/src/type/attr/container.rs#L54
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
|
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do:
crates/specta-macros/src/utils.rs#L218
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)
|
called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead:
crates/specta-macros/src/type/attr/common.rs#L75
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")
|
|
called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead:
crates/specta-macros/src/type/attr/common.rs#L61
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")
|
|
called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead:
crates/specta-macros/src/type/attr/common.rs#L46
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
|
calling `push_str()` using a single-character string literal:
crates/specta-macros/src/type/attr/common.rs#L38
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
|
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do:
crates/specta-macros/src/type/attr/common.rs#L32
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
|
redundant pattern matching, consider using `is_some()`:
crates/specta-macros/src/specta.rs#L37
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
|
length comparison to zero:
crates/specta-macros/src/data_type_from/mod.rs#L24
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
|
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do:
crates/specta-macros/src/utils.rs#L218
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/data_type_from/attr/field.rs:13:1
|
13 | / impl_parse! {
14 | | FieldAttr(attr, out) {
15 | | "skip" => out.skip = true,
16 | | "rename" => {
... |
22 | | }
23 | | }
| |_- 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)
|
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do:
crates/specta-macros/src/utils.rs#L218
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/data_type_from/attr/container.rs:12:1
|
12 | / impl_parse! {
13 | | ContainerAttr(attr, out) {
14 | | "crate" => out.crate_name = out.crate_name.take().or(Some(attr.parse_path()?.into_token_stream())),
15 | | }
16 | | }
| |_- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: `#[warn(clippy::ptr_arg)]` on by default
= note: this warning originates in the macro `impl_parse` (in Nightly builds, run with -Z macro-backtrace for more info)
|
useless conversion to the same type: `proc_macro2::TokenStream`:
crates/specta-macros/src/utils.rs#L206
warning: useless conversion to the same type: `proc_macro2::TokenStream`
--> crates/specta-macros/src/utils.rs:206:55
|
206 | let attr = syn::parse::Parser::parse2(parser, attr.tokens.clone().into())?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `attr.tokens.clone()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: `#[warn(clippy::useless_conversion)]` on by default
|
calling `push_str()` using a single-character string literal:
crates/specta/src/lang/ts/mod.rs#L166
warning: calling `push_str()` using a single-character string literal
--> crates/specta/src/lang/ts/mod.rs:166:5
|
166 | s.push_str(";");
| ^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `s.push(';')`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_add_str
|
calling `push_str()` using a single-character string literal:
crates/specta/src/lang/ts/mod.rs#L159
warning: calling `push_str()` using a single-character string literal
--> crates/specta/src/lang/ts/mod.rs:159:5
|
159 | s.push_str(")");
| ^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `s.push(')')`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_add_str
|
calling `push_str()` using a single-character string literal:
crates/specta/src/lang/ts/mod.rs#L149
warning: calling `push_str()` using a single-character string literal
--> crates/specta/src/lang/ts/mod.rs:149:5
|
149 | s.push_str("(");
| ^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `s.push('(')`
|
= 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)]` implied by `#[warn(clippy::all)]`
|
unnecessary use of `get(&sid).is_none()`:
crates/specta/src/datatype/reference.rs#L22
warning: unnecessary use of `get(&sid).is_none()`
--> crates/specta/src/datatype/reference.rs:22:21
|
22 | if type_map.map.get(&sid).is_none() {
| -------------^^^^^^^^^^^^^^^^^^^
| |
| help: replace it with: `!type_map.map.contains_key(&sid)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check
= note: `#[warn(clippy::unnecessary_get_then_check)]` implied by `#[warn(clippy::all)]`
|
this function has too many arguments (8/7):
crates/specta/src/internal.rs#L232
warning: this function has too many arguments (8/7)
--> crates/specta/src/internal.rs:232:5
|
232 | / pub fn get_fn_datatype<TMarker, T: Function<TMarker>>(
233 | | _: T,
234 | | asyncness: bool,
235 | | name: Cow<'static, str>,
... |
240 | | no_return_type: bool,
241 | | ) -> FunctionDataType {
| |_________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
= note: `#[warn(clippy::too_many_arguments)]` implied by `#[warn(clippy::all)]`
|
`panic` should not be present in production code:
crates/specta/src/internal/interop.rs#L344
warning: `panic` should not be present in production code
--> crates/specta/src/internal/interop.rs:344:32
|
344 | DataType::Result(_) => panic!("Specta v1 does not support Result types"),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#panic
|
`panic` should not be present in production code:
crates/specta/src/internal/interop.rs#L44
warning: `panic` should not be present in production code
--> crates/specta/src/internal/interop.rs:44:37
|
44 | LiteralType::char(_) => panic!("Specta v1 does not support char literals"),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#panic
|
`panic` should not be present in production code:
crates/specta/src/internal/interop.rs#L13
warning: `panic` should not be present in production code
--> crates/specta/src/internal/interop.rs:13:30
|
13 | DataType::Unknown => panic!("Specta v1 does not support unknown types"),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#panic
note: the lint level is defined here
--> crates/specta/src/lib.rs:3:43
|
3 | #![warn(clippy::all, clippy::unwrap_used, clippy::panic)] // TODO: missing_docs
| ^^^^^^^^^^^^^
|
needless `fn main` in doctest:
crates/specta/src/./docs.md#L22
warning: needless `fn main` in doctest
--> crates/specta/src/./docs.md:22:1
|
22 | / use specta::{*, ts::*};
23 | |
24 | | #[derive(Type)]
25 | | pub struct MyCustomType {
... |
33 | | );
34 | | }
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_doctest_main
note: the lint level is defined here
--> crates/specta/src/lib.rs:3:9
|
3 | #![warn(clippy::all, clippy::unwrap_used, clippy::panic)] // TODO: missing_docs
| ^^^^^^^^^^^
= note: `#[warn(clippy::needless_doctest_main)]` implied by `#[warn(clippy::all)]`
|
constant `RESERVED_IDENTS` is never used:
crates/specta/src/lang/ts/reserved_terms.rs#L66
warning: constant `RESERVED_IDENTS` is never used
--> crates/specta/src/lang/ts/reserved_terms.rs:66:18
|
66 | pub(crate) const RESERVED_IDENTS: &[&str] = &[
| ^^^^^^^^^^^^^^^
|
field `0` is never read:
crates/specta/src/lang/ts/context.rs#L10
warning: field `0` is never read
--> crates/specta/src/lang/ts/context.rs:10:18
|
10 | 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
|
10 | TypeExtended((), ImplLocation),
| ~~
|
unused variable: `name`:
crates/specta/src/internal/interop.rs#L112
warning: unused variable: `name`
--> crates/specta/src/internal/interop.rs:112:32
|
112 | .map(|(name, v)| match v.inner() {
| ^^^^ help: if this is intentional, prefix it with an underscore: `_name`
|
= note: `#[warn(unused_variables)]` on by default
|
unused import: `selection::*`:
crates/specta/src/lib.rs#L37
warning: unused import: `selection::*`
--> crates/specta/src/lib.rs:37:9
|
37 | pub use selection::*;
| ^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
crates/specta-macros/src/type/generics.rs#L241
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
|
this expression creates a reference which is immediately dereferenced by the compiler:
crates/specta-macros/src/type/generics.rs#L192
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
|
this expression creates a reference which is immediately dereferenced by the compiler:
crates/specta-macros/src/type/generics.rs#L169
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
|
this expression creates a reference which is immediately dereferenced by the compiler:
crates/specta-macros/src/type/generics.rs#L151
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
|
this expression creates a reference which is immediately dereferenced by the compiler:
crates/specta-macros/src/type/generics.rs#L131
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
|
field assignment outside of initializer for an instance created with Default::default():
crates/specta-macros/src/type/attr/variant.rs#L32
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
|
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do:
crates/specta-macros/src/utils.rs#L218
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)
|
field assignment outside of initializer for an instance created with Default::default():
crates/specta-macros/src/type/attr/field.rs#L54
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
|
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do:
crates/specta-macros/src/utils.rs#L218
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)
|
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do:
crates/specta-macros/src/utils.rs#L218
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)
|
field assignment outside of initializer for an instance created with Default::default():
crates/specta-macros/src/type/attr/container.rs#L54
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
|
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do:
crates/specta-macros/src/utils.rs#L218
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)
|
called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead:
crates/specta-macros/src/type/attr/common.rs#L75
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")
|
|
called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead:
crates/specta-macros/src/type/attr/common.rs#L61
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")
|
|
called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead:
crates/specta-macros/src/type/attr/common.rs#L46
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
|
calling `push_str()` using a single-character string literal:
crates/specta-macros/src/type/attr/common.rs#L38
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
|
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do:
crates/specta-macros/src/type/attr/common.rs#L32
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
|
redundant pattern matching, consider using `is_some()`:
crates/specta-macros/src/specta.rs#L37
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
|
length comparison to zero:
crates/specta-macros/src/data_type_from/mod.rs#L24
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
|
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do:
crates/specta-macros/src/utils.rs#L218
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/data_type_from/attr/field.rs:13:1
|
13 | / impl_parse! {
14 | | FieldAttr(attr, out) {
15 | | "skip" => out.skip = true,
16 | | "rename" => {
... |
22 | | }
23 | | }
| |_- 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)
|
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do:
crates/specta-macros/src/utils.rs#L218
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/data_type_from/attr/container.rs:12:1
|
12 | / impl_parse! {
13 | | ContainerAttr(attr, out) {
14 | | "crate" => out.crate_name = out.crate_name.take().or(Some(attr.parse_path()?.into_token_stream())),
15 | | }
16 | | }
| |_- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: `#[warn(clippy::ptr_arg)]` on by default
= note: this warning originates in the macro `impl_parse` (in Nightly builds, run with -Z macro-backtrace for more info)
|
useless conversion to the same type: `proc_macro2::TokenStream`:
crates/specta-macros/src/utils.rs#L206
warning: useless conversion to the same type: `proc_macro2::TokenStream`
--> crates/specta-macros/src/utils.rs:206:55
|
206 | let attr = syn::parse::Parser::parse2(parser, attr.tokens.clone().into())?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `attr.tokens.clone()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: `#[warn(clippy::useless_conversion)]` on by default
|
clippy
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions-rs/clippy-check@v1. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|
clippy
The following actions uses node12 which is deprecated and will be forced to run on node16: actions-rs/clippy-check@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|