Skip to content

Specta CLI

Specta CLI #336

GitHub Actions / clippy succeeded Dec 24, 2023 in 0s

clippy

20 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 20
Note 0
Help 0

Versions

  • rustc 1.74.1 (a28077b28 2023-12-04)
  • cargo 1.74.1 (ecb9851af 2023-10-18)
  • clippy 0.1.74 (a28077b 2023-12-04)

Annotations

Check warning on line 238 in src/internal.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (8/7)

warning: this function has too many arguments (8/7)
   --> src/internal.rs:229:5
    |
229 | /     pub fn get_fn_datatype<TMarker, T: SpectaFunction<TMarker>>(
230 | |         _: T,
231 | |         asyncness: bool,
232 | |         name: Cow<'static, str>,
...   |
237 | |         no_return_type: bool,
238 | |     ) -> FunctionDataType {
    | |_________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
note: the lint level is defined here
   --> src/lib.rs:3:9
    |
3   | #![warn(clippy::all, clippy::unwrap_used, clippy::panic)] // TODO: missing_docs
    |         ^^^^^^^^^^^
    = note: `#[warn(clippy::too_many_arguments)]` implied by `#[warn(clippy::all)]`

Check warning on line 66 in src/lang/ts/reserved_terms.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

constant `RESERVED_IDENTS` is never used

warning: constant `RESERVED_IDENTS` is never used
  --> src/lang/ts/reserved_terms.rs:66:18
   |
66 | pub(crate) const RESERVED_IDENTS: &[&str] = &[
   |                  ^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

Check warning on line 32 in macros/src/type/attr/variant.rs

See this annotation in the file changed.

@github-actions 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()
  --> 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
  --> 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 216 in macros/src/utils.rs

See this annotation in the file changed.

@github-actions 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
   --> macros/src/utils.rs:216:24
    |
216 |                   attrs: &mut Vec<crate::utils::Attribute>,
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
    |
   ::: 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 macros/src/type/attr/field.rs

See this annotation in the file changed.

@github-actions 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()
  --> 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
  --> 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 216 in macros/src/utils.rs

See this annotation in the file changed.

@github-actions 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
   --> macros/src/utils.rs:216:24
    |
216 |                   attrs: &mut Vec<crate::utils::Attribute>,
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
    |
   ::: 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 216 in macros/src/utils.rs

See this annotation in the file changed.

@github-actions 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
   --> macros/src/utils.rs:216:24
    |
216 |                   attrs: &mut Vec<crate::utils::Attribute>,
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
    |
   ::: 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 macros/src/type/attr/container.rs

See this annotation in the file changed.

@github-actions 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()
  --> 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
  --> 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 216 in macros/src/utils.rs

See this annotation in the file changed.

@github-actions 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
   --> macros/src/utils.rs:216:24
    |
216 |                   attrs: &mut Vec<crate::utils::Attribute>,
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
    |
   ::: 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 macros/src/type/attr/common.rs

See this annotation in the file changed.

@github-actions 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
  --> 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 macros/src/type/attr/common.rs

See this annotation in the file changed.

@github-actions 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
  --> 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 macros/src/type/attr/common.rs

See this annotation in the file changed.

@github-actions 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
  --> 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 macros/src/type/attr/common.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

calling `push_str()` using a single-character string literal

warning: calling `push_str()` using a single-character string literal
  --> 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 macros/src/type/attr/common.rs

See this annotation in the file changed.

@github-actions 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
  --> 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 24 in macros/src/specta.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

redundant pattern matching, consider using `is_some()`

warning: redundant pattern matching, consider using `is_some()`
  --> macros/src/specta.rs:21:30
   |
21 |       let function_asyncness = match function.sig.asyncness {
   |  ______________________________^
22 | |         Some(_) => true,
23 | |         None => false,
24 | |     };
   | |_____^ 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 macros/src/data_type_from/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

length comparison to zero

warning: length comparison to zero
  --> 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

Check warning on line 216 in macros/src/utils.rs

See this annotation in the file changed.

@github-actions 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
   --> macros/src/utils.rs:216:24
    |
216 |                   attrs: &mut Vec<crate::utils::Attribute>,
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
    |
   ::: 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)

Check warning on line 216 in macros/src/utils.rs

See this annotation in the file changed.

@github-actions 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
   --> macros/src/utils.rs:216:24
    |
216 |                   attrs: &mut Vec<crate::utils::Attribute>,
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
    |
   ::: 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)

Check warning on line 204 in macros/src/utils.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless conversion to the same type: `proc_macro2::TokenStream`

warning: useless conversion to the same type: `proc_macro2::TokenStream`
   --> macros/src/utils.rs:204:55
    |
204 |         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

Check warning on line 3 in macros-support/src/struct.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `ty`

warning: unused variable: `ty`
 --> macros-support/src/struct.rs:3:21
  |
3 | pub fn parse_struct(ty: ItemStruct) {
  |                     ^^ help: if this is intentional, prefix it with an underscore: `_ty`
  |
  = note: `#[warn(unused_variables)]` on by default