Restructure #405
Annotations
9 errors and 115 warnings
build (macos-latest)
ENOENT: no such file or directory, opendir '/Users/runner/work/specta/specta/target/tests/target'
|
build (macos-latest)
Error: ENOENT: no such file or directory, opendir '/Users/runner/work/specta/specta/target/tests/target'
|
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.
|
build (ubuntu-latest)
ENOENT: no such file or directory, opendir '/home/runner/work/specta/specta/target/tests/target'
|
build (ubuntu-latest)
Error: ENOENT: no such file or directory, opendir '/home/runner/work/specta/specta/target/tests/target'
|
this expression always evaluates to true:
specta-zod/src/lib.rs#L112
warning: this expression always evaluates to true
--> 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:
specta-zod/src/context.rs#L8
warning: field `0` is never read
--> 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),
| ~~
|
passing a unit value to a function:
specta-typescript/src/lib.rs#L649
warning: passing a unit value to a function
--> specta-typescript/src/lib.rs:649:5
|
649 | / Ok(match &e.repr() {
650 | | EnumRepr::Untagged => {
651 | | let mut variants = e
652 | | .variants()
... |
788 | | }
789 | | })
| |______^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unit_arg
help: move the expression in front of the call and replace it with the unit literal `()`
|
649 ~ match &e.repr() {
650 + EnumRepr::Untagged => {
651 + let mut variants = e
652 + .variants()
653 + .iter()
654 + .filter(|(_, variant)| !variant.skip())
655 + .map(|(name, variant)| {
656 + Ok(match variant.inner() {
657 + EnumVariants::Unit => NULL.to_string(),
658 + _ => inner_comments(
659 + ctx.clone(),
660 + variant.deprecated(),
661 + variant.docs(),
662 + enum_variant_datatype(
663 + ctx.with(PathItem::Variant(name.clone())),
664 + type_map,
665 + name.clone(),
666 + variant,
667 + )?
668 + .expect("Invalid Serde type"),
669 + true,
670 + ),
671 + })
672 + })
673 + .collect::<Result<Vec<_>>>()?;
674 + variants.dedup();
675 + s.push_str(&variants.join(" | "));
676 + }
677 + repr => {
678 + let mut variants = e
679 + .variants()
680 + .iter()
681 + .filter(|(_, variant)| !variant.skip())
682 + .map(|(variant_name, variant)| {
683 + let sanitised_name = sanitise_key(variant_name.clone(), true);
684 +
685 + Ok(inner_comments(
686 + ctx.clone(),
687 + variant.deprecated(),
688 + variant.docs(),
689 + match (repr, &variant.inner()) {
690 + (EnumRepr::Untagged, _) => unreachable!(),
691 + (EnumRepr::Internal { tag }, EnumVariants::Unit) => {
692 + format!("{{ {tag}: {sanitised_name} }}")
693 + }
694 + (EnumRepr::Internal { tag }, EnumVariants::Unnamed(tuple)) => {
695 + let fields = skip_fields(tuple.fields()).collect::<Vec<_>>();
696 +
697 + // This field is only required for `{ty}` not `[...]` so we only need to check when there one field
698 + let dont_join_ty = if tuple.fields().len() == 1 {
699 + let (_, ty) = fields.first().expect("checked length above");
700 + validate_type_for_tagged_intersection(
701 + ctx.clone(),
702 + (**ty).clone(),
703 + type_map,
704 + )?
705 + } else {
706 + false
707 + };
708 +
709 + let mut typ = String::new();
710 +
711 + unnamed_fields_datatype(ctx.clone(), &fields, type_map, &mut typ)?;
712 +
713 + if dont_join_ty {
714 + format!("({{ {tag}: {sanitised_name} }})")
715 + } else {
716 + // We wanna be sure `... & ... | ...` becomes `... & (... | ...)`
717 + if typ.contains('|') {
718 + typ = format!("({typ})");
719 + }
720 + format!("({{ {tag}: {sanitised_name} }} & {typ})")
721 + }
722 + }
723 + (EnumRepr::Internal { tag }, EnumVariants::Named(obj)) => {
724 + let mut fields = vec![format!("{tag}: {sanitised_name}")];
725 +
726 + for (name, field) in skip_fields_named(obj.fields()) {
727 + let mut other = String::new();
728 + object_field_to_ts(
729 + ctx.with(PathItem::Field(name.clone())),
730 + name.clone(),
731 + field,
732 + type_map,
733 + &mut other,
734 + )?;
735 + fields.push(other);
736 + }
737 +
738 + format!("{{ {} }}", fields.join("; "))
739 + }
740 + (EnumRepr::External, EnumVariants::Unit) => sanitised_name.to_string(),
741 + (EnumRepr::External, _) => {
742 + let ts_values = enum_variant_datatype(
743 + ctx.with(PathItem::Variant(variant_name.clone())),
744 + type_map,
745 + variant_name.clone(),
746 + variant,
747 + )?;
748 + let sanitised_name = sanitise_key(variant_name.clone(), false);
749 +
750 + match ts_values {
751 + Some(ts_values) => {
752 + format!("{{ {sanitised_name}: {ts_values} }}")
753 + }
754 + None => format!(r#""{sanitised_name}""#),
755 + }
756 + }
757 + (EnumRepr::Adjacent { tag, .. }, EnumVariants::Unit) => {
758 + format!("{{ {tag}: {sanitised_name} }}")
759 + }
760 + (EnumRepr::Adjacent { tag, content }, _) => {
761 + let ts_value = enum_variant_datatype(
762 + ctx.with(PathItem::Variant(variant_name.clone())),
763 + type_map,
764 + variant_name.clone(),
765 + variant,
766 + )?;
767 +
768 + let mut s = String::new();
769 +
770 + s.push_str("{ ");
771 +
772 + write!(s, "{tag}: {sanitised_name}")?;
773 + if let Some(ts_value) = ts_value {
774 + write!(s, "; {content}: {ts_value}")?;
775 + }
776 +
777 + s.push_str(" }");
778 +
779 + s
780 + }
781 + },
782 + true,
783 + ))
784 + })
785 + .collect::<Result<Vec<_>>>()?;
786 + variants.dedup();
787 + s.push_str(&variants.join(" | "));
788 + }
789 + };
790 + Ok(())
|
|
passing a unit value to a function:
specta-typescript/src/lib.rs#L503
warning: passing a unit value to a function
--> specta-typescript/src/lib.rs:503:24
|
503 | return Ok(match named.tag().as_ref() {
| ________________________^
504 | | Some(tag) => write!(s, r#"{{ "{tag}": "{key}" }}"#)?,
505 | | None => write!(s, "Record<{STRING}, {NEVER}>")?,
506 | | });
| |__________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unit_arg
help: move the expression in front of the call and replace it with the unit literal `()`
|
503 ~ return {
504 + match named.tag().as_ref() {
505 + Some(tag) => write!(s, r#"{{ "{tag}": "{key}" }}"#)?,
506 + None => write!(s, "Record<{STRING}, {NEVER}>")?,
507 + };
508 + Ok(())
509 ~ };
|
|
passing a unit value to a function:
specta-typescript/src/lib.rs#L491
warning: passing a unit value to a function
--> specta-typescript/src/lib.rs:491:5
|
491 | / Ok(match &strct.fields() {
492 | | StructFields::Unit => s.push_str(NULL),
493 | | StructFields::Unnamed(unnamed) => unnamed_fields_datatype(
494 | | ctx,
... |
562 | | }
563 | | })
| |______^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unit_arg
help: move the expression in front of the call and replace it with the unit literal `()`
|
491 ~ match &strct.fields() {
492 + StructFields::Unit => s.push_str(NULL),
493 + StructFields::Unnamed(unnamed) => unnamed_fields_datatype(
494 + ctx,
495 + &skip_fields(unnamed.fields()).collect::<Vec<_>>(),
496 + type_map,
497 + s,
498 + )?,
499 + StructFields::Named(named) => {
500 + let fields = skip_fields_named(named.fields()).collect::<Vec<_>>();
501 +
502 + if fields.is_empty() {
503 + return Ok(match named.tag().as_ref() {
504 + Some(tag) => write!(s, r#"{{ "{tag}": "{key}" }}"#)?,
505 + None => write!(s, "Record<{STRING}, {NEVER}>")?,
506 + });
507 + }
508 +
509 + let (flattened, non_flattened): (Vec<_>, Vec<_>) =
510 + fields.iter().partition(|(_, (f, _))| f.flatten());
511 +
512 + let mut field_sections = flattened
513 + .into_iter()
514 + .map(|(key, (field, ty))| {
515 + let mut s = String::new();
516 + datatype_inner(ctx.with(PathItem::Field(key.clone())), ty, type_map, &mut s)
517 + .map(|_| {
518 + inner_comments(
519 + ctx.clone(),
520 + field.deprecated(),
521 + field.docs(),
522 + format!("({s})"),
523 + true,
524 + )
525 + })
526 + })
527 + .collect::<Result<Vec<_>>>()?;
528 +
529 + let mut unflattened_fields = non_flattened
530 + .into_iter()
531 + .map(|(key, field_ref)| {
532 + let (field, _) = field_ref;
533 +
534 + let mut other = String::new();
535 + object_field_to_ts(
536 + ctx.with(PathItem::Field(key.clone())),
537 + key.clone(),
538 + field_ref,
539 + type_map,
540 + &mut other,
541 + )?;
542 +
543 + Ok(inner_comments(
544 + ctx.clone(),
545 + field.deprecated(),
546 + field.docs(),
547 + other,
548 + true,
549 + ))
550 + })
551 + .collect::<Result<Vec<_>>>()?;
552 +
553 + if let Some(tag) = &named.tag() {
554 + unflattened_fields.push(format!("{tag}: \"{key}\""));
555 + }
556 +
557 + if !unflattened_fields.is_empty() {
558 + field_sections.push(format!("{{ {} }}", unflattened_fields.join("; ")));
559 + }
560 +
561 + s.push_str(&field_sections.join(" & "));
562 + }
563 + };
564 + Ok(())
|
|
passing a unit value to a function:
specta-typescript/src/lib.rs#L432
warning: passing a unit value to a function
--> specta-typescript/src/lib.rs:432:5
|
432 | / Ok(match fields {
433 | | [(field, ty)] => {
434 | | let mut v = String::new();
435 | | datatype_inner(ctx.clone(), ty, type_map, &mut v)?;
... |
464 | | }
465 | | })
| |______^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unit_arg
help: move the expression in front of the call and replace it with the unit literal `()`
|
432 ~ match fields {
433 + [(field, ty)] => {
434 + let mut v = String::new();
435 + datatype_inner(ctx.clone(), ty, type_map, &mut v)?;
436 + s.push_str(&inner_comments(
437 + ctx,
438 + field.deprecated(),
439 + field.docs(),
440 + v,
441 + true,
442 + ));
443 + }
444 + fields => {
445 + s.push('[');
446 +
447 + for (i, (field, ty)) in fields.iter().enumerate() {
448 + if i != 0 {
449 + s.push_str(", ");
450 + }
451 +
452 + let mut v = String::new();
453 + datatype_inner(ctx.clone(), ty, type_map, &mut v)?;
454 + s.push_str(&inner_comments(
455 + ctx.clone(),
456 + field.deprecated(),
457 + field.docs(),
458 + v,
459 + true,
460 + ));
461 + }
462 +
463 + s.push(']');
464 + }
465 + };
466 + Ok(())
|
|
this expression creates a reference which is immediately dereferenced by the compiler:
specta-typescript/src/lib.rs#L402
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> specta-typescript/src/lib.rs:402:28
|
402 | s.push_str(&reference.name());
| ^^^^^^^^^^^^^^^^^ help: change this to: `reference.name()`
|
= 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:
specta-typescript/src/lib.rs#L400
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> specta-typescript/src/lib.rs:400:30
|
400 | [] => s.push_str(&reference.name()),
| ^^^^^^^^^^^^^^^^^ help: change this to: `reference.name()`
|
= 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:
specta-typescript/src/lib.rs#L327
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> specta-typescript/src/lib.rs:327:33
|
327 | datatype_inner(ctx, &def.ty(), type_map, &mut dt)?;
| ^^^^^^^^^ help: change this to: `def.ty()`
|
= 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
|
passing a unit value to a function:
specta-typescript/src/lib.rs#L269
warning: passing a unit value to a function
--> specta-typescript/src/lib.rs:269:5
|
269 | / Ok(match &typ {
270 | | DataType::Any => s.push_str(ANY),
271 | | DataType::Unknown => s.push_str(UNKNOWN),
272 | | DataType::Primitive(p) => {
... |
421 | | DataType::Generic(ident) => s.push_str(&ident.to_string()),
422 | | })
| |______^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unit_arg
= note: `#[warn(clippy::unit_arg)]` on by default
help: move the expression in front of the call and replace it with the unit literal `()`
|
269 ~ match &typ {
270 + DataType::Any => s.push_str(ANY),
271 + DataType::Unknown => s.push_str(UNKNOWN),
272 + DataType::Primitive(p) => {
273 + let ctx = ctx.with(PathItem::Type(p.to_rust_str().into()));
274 + let str = match p {
275 + primitive_def!(i8 i16 i32 u8 u16 u32 f32 f64) => NUMBER,
276 + primitive_def!(usize isize i64 u64 i128 u128) => match ctx.cfg.bigint {
277 + BigIntExportBehavior::String => STRING,
278 + BigIntExportBehavior::Number => NUMBER,
279 + BigIntExportBehavior::BigInt => BIGINT,
280 + BigIntExportBehavior::Fail => {
281 + return Err(ExportError::BigIntForbidden(ctx.export_path()));
282 + }
283 + BigIntExportBehavior::FailWithReason(reason) => {
284 + return Err(ExportError::Other(ctx.export_path(), reason.to_owned()))
285 + }
286 + },
287 + primitive_def!(String char) => STRING,
288 + primitive_def!(bool) => BOOLEAN,
289 + };
290 +
291 + s.push_str(str);
292 + }
293 + DataType::Literal(literal) => match literal {
294 + LiteralType::i8(v) => write!(s, "{v}")?,
295 + LiteralType::i16(v) => write!(s, "{v}")?,
296 + LiteralType::i32(v) => write!(s, "{v}")?,
297 + LiteralType::u8(v) => write!(s, "{v}")?,
298 + LiteralType::u16(v) => write!(s, "{v}")?,
299 + LiteralType::u32(v) => write!(s, "{v}")?,
300 + LiteralType::f32(v) => write!(s, "{v}")?,
301 + LiteralType::f64(v) => write!(s, "{v}")?,
302 + LiteralType::bool(v) => write!(s, "{v}")?,
303 + LiteralType::String(v) => write!(s, r#""{v}""#)?,
304 + LiteralType::char(v) => write!(s, r#""{v}""#)?,
305 + LiteralType::None => s.write_str(NULL)?,
306 + _ => unreachable!(),
307 + },
308 + DataType::Nullable(def) => {
309 + datatype_inner(ctx, def, type_map, s)?;
310 +
311 + let or_null = format!(" | {NULL}");
312 + if !s.ends_with(&or_null) {
313 + s.push_str(&or_null);
314 + }
315 + }
316 + DataType::Map(def) => {
317 + // We use this instead of `Record<K, V>` to avoid issues with circular references.
318 + s.push_str("{ [key in ");
319 + datatype_inner(ctx.clone(), def.key_ty(), type_map, s)?;
320 + s.push_str("]: ");
321 + datatype_inner(ctx.clone(), def.value_ty(), type_map, s)?;
322 + s.push_str(" }");
323 + }
324 + // We use `T[]` instead of `Array<T>` to avoid issues with circular references.
325 + DataType::List(def) => {
326 + let mut dt = String::new();
327 + datatype_inner(ctx, &def.ty(), type_map, &mut dt)?;
328 +
329 + let dt = if (dt.contains(' ') && !dt.ends_with('}'))
330 + // This is to do with maintaining order of operations.
331 + // Eg `{} | {}` must be wrapped in parens like `({} | {})[]` but `{}` doesn't cause `{}[]` is valid
332 + || (dt.contains(' ') && (dt.contains('&') || dt.contains('|')))
333 + {
334 + format!("({dt})")
335 + } else {
336 + dt
337 + };
338 +
339 + if let Some(length) = def.length() {
340 + s.push('[');
341 +
342 + for n in 0..length {
343 + if n != 0 {
344 + s.push_str(", ");
345 + }
346 +
347 + s.push_str(&dt);
348 + }
349 +
350 + s.push(']');
351 + } else {
352 + write!(s, "{dt}[]")?;
353 + }
354 + }
355 + DataType::Struct(item) => struct_datatype(
356 + ctx.with(
357 + item.sid()
358 + .and_then(|sid| type_map.get(*sid))
359 + .and_then(|v| v.ext())
360 + .map(|v| PathItem::TypeExtended(item.name().clone(), *v.impl_location()))
361 + .unwrap_or_else(|| PathItem::Type(item.name().clone())),
362 + ),
363 + item.name(),
364 + item,
365 + type_map,
366 + s,
367 + )?,
368 + DataType::Enum(item) => {
369 + let mut ctx = ctx.clone();
370 + let cfg = ctx.cfg.clone().bigint(BigIntExportBehavior::Number);
371 + if item.skip_bigint_checks() {
372 + ctx.cfg = &cfg;
373 + }
374 +
375 + enum_datatype(
376 + ctx.with(PathItem::Variant(item.name().clone())),
377 + item,
378 + type_map,
379 + s,
380 + )?
381 + }
382 + DataType::Tuple(tuple) => s.push_str(&tuple_datatype(ctx, tuple, type_map)?),
383 + DataType::Result(result) => {
384 + let mut variants = vec![
385 + {
386 + let mut v = String::new();
387 + datatype_inner(ctx.clone(), &result.0, type_map, &mut v)?;
388 + v
389 + },
390 + {
391 + let mut v = String::new();
392 + datatype_inner(ctx, &result.1, type_map, &mut v)?;
393 + v
394 + },
395 + ];
396 + variants.dedup();
397 + s.push_str(&variants.join(" | "));
398 + }
399 + DataType::Reference(reference) => match &reference.generics()[..] {
400 + [] => s.push_str(&reference.name()),
401 + generics => {
402 + s.push_str(&reference.name());
403 + s.push('<');
404 +
405 + for (i, (_, v)) in generics.iter().enumerate() {
406 + if i != 0 {
407 + s.push_str(", ");
408 + }
409 +
410 + datatype_inner(
411 + ctx.with(PathItem::Type(reference.name().clone())),
412 + v,
413 + type_map,
414 + s,
415 + )?;
416 + }
417 +
418 + s.push('>');
419 + }
420 + },
421 + DataType::Generic(ident) => s.push_str(&ident.to_string()),
422 + };
423 + Ok(())
|
|
using `clone` on type `Option<&NamedDataTypeExt>` which implements the `Copy` trait:
specta-typescript/src/lib.rs#L213
warning: using `clone` on type `Option<&NamedDataTypeExt>` which implements the `Copy` trait
--> specta-typescript/src/lib.rs:213:9
|
213 | ext.clone()
| ^^^^^^^^^^^ help: try removing the `clone` call: `ext`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
= note: `#[warn(clippy::clone_on_copy)]` on by default
|
calling `push_str()` using a single-character string literal:
specta-typescript/src/lib.rs#L175
warning: calling `push_str()` using a single-character string literal
--> specta-typescript/src/lib.rs:175:5
|
175 | 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:
specta-typescript/src/lib.rs#L168
warning: calling `push_str()` using a single-character string literal
--> specta-typescript/src/lib.rs:168:5
|
168 | 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:
specta-typescript/src/lib.rs#L158
warning: calling `push_str()` using a single-character string literal
--> specta-typescript/src/lib.rs:158:5
|
158 | 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)]` on by default
|
constant `RESERVED_IDENTS` is never used:
specta-typescript/src/reserved_terms.rs#L66
warning: constant `RESERVED_IDENTS` is never used
--> specta-typescript/src/reserved_terms.rs:66:18
|
66 | pub(crate) const RESERVED_IDENTS: &[&str] = &[
| ^^^^^^^^^^^^^^^
|
method `push_generic` is never used:
specta-typescript/src/js_doc.rs#L98
warning: method `push_generic` is never used
--> specta-typescript/src/js_doc.rs:98:12
|
59 | impl Builder {
| ------------ method in this implementation
...
98 | pub fn push_generic(&mut self, generic: &GenericType) {
| ^^^^^^^^^^^^
|
function `typedef_named_datatype_inner` is never used:
specta-typescript/src/js_doc.rs#L24
warning: function `typedef_named_datatype_inner` is never used
--> specta-typescript/src/js_doc.rs:24:4
|
24 | fn typedef_named_datatype_inner(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
function `typedef_named_datatype` is never used:
specta-typescript/src/js_doc.rs#L7
warning: function `typedef_named_datatype` is never used
--> specta-typescript/src/js_doc.rs:7:8
|
7 | pub fn typedef_named_datatype(
| ^^^^^^^^^^^^^^^^^^^^^^
|
field `0` is never read:
specta-typescript/src/context.rs#L10
warning: field `0` is never read
--> specta-typescript/src/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 import: `fmt::Display`:
specta-typescript/src/lib.rs#L4
warning: unused import: `fmt::Display`
--> specta-typescript/src/lib.rs:4:24
|
4 | use std::{borrow::Cow, fmt::Display};
| ^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
|
redundant closure:
specta-rust/src/lib.rs#L33
warning: redundant closure
--> specta-rust/src/lib.rs:33:26
|
33 | .map(|v| datatype(v))
| ^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `datatype`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
= note: `#[warn(clippy::redundant_closure)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
specta-rust/src/lib.rs#L24
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> specta-rust/src/lib.rs:24:22
|
24 | datatype(&t.value_ty())?
| ^^^^^^^^^^^^^ help: change this to: `t.value_ty()`
|
= 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:
specta-rust/src/lib.rs#L23
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> specta-rust/src/lib.rs:23:22
|
23 | datatype(&t.key_ty())?,
| ^^^^^^^^^^^ help: change this to: `t.key_ty()`
|
= 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
|
unused variable: `s`:
specta-rust/src/lib.rs#L38
warning: unused variable: `s`
--> specta-rust/src/lib.rs:38:26
|
38 | DataType::Struct(s) => {
| ^ help: if this is intentional, prefix it with an underscore: `_s`
|
= note: `#[warn(unused_variables)]` on by default
|
returning the result of a `let` binding from a block:
specta-openapi/src/lib.rs#L87
warning: returning the result of a `let` binding from a block
--> specta-openapi/src/lib.rs:87:13
|
85 | let schema = to_openapi(def);
| ----------------------------- unnecessary `let` binding
86 | // schema.schema_data.nullable = true; // TODO
87 | schema
| ^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
= note: `#[warn(clippy::let_and_return)]` on by default
help: return the expression directly
|
85 ~
86 | // schema.schema_data.nullable = true; // TODO
87 ~ to_openapi(def)
|
|
this expression creates a reference which is immediately dereferenced by the compiler:
specta-kotlin/src/lib.rs#L54
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> specta-kotlin/src/lib.rs:54:58
|
54 | DataType::Nullable(t) => format!("{}?", datatype(&t)?),
| ^^ help: change this to: `t`
|
= 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:
specta-kotlin/src/lib.rs#L34
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> specta-kotlin/src/lib.rs:34:22
|
34 | datatype(&t.value_ty())?
| ^^^^^^^^^^^^^ help: change this to: `t.value_ty()`
|
= 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:
specta-kotlin/src/lib.rs#L33
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> specta-kotlin/src/lib.rs:33:22
|
33 | datatype(&t.key_ty())?,
| ^^^^^^^^^^^ help: change this to: `t.key_ty()`
|
= 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
|
unused variable: `generics`:
specta-openapi/src/lib.rs#L250
warning: unused variable: `generics`
--> specta-openapi/src/lib.rs:250:13
|
250 | generics => {
| ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_generics`
|
unused variable: `e`:
specta-openapi/src/lib.rs#L164
warning: unused variable: `e`
--> specta-openapi/src/lib.rs:164:24
|
164 | DataType::Enum(e) => {
| ^ help: if this is intentional, prefix it with an underscore: `_e`
|
unused variable: `name`:
specta-openapi/src/lib.rs#L118
warning: unused variable: `name`
--> specta-openapi/src/lib.rs:118:17
|
118 | let name = s.name();
| ^^^^ help: if this is intentional, prefix it with an underscore: `_name`
|
unused variable: `fields`:
specta-openapi/src/lib.rs#L117
warning: unused variable: `fields`
--> specta-openapi/src/lib.rs:117:17
|
117 | let fields = s.fields();
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_fields`
|
unused variable: `tys`:
specta-openapi/src/lib.rs#L114
warning: unused variable: `tys`
--> specta-openapi/src/lib.rs:114:13
|
114 | tys => todo!(),
| ^^^ help: if this is intentional, prefix it with an underscore: `_tys`
|
= note: `#[warn(unused_variables)]` on by default
|
unused variable: `tag`:
specta-kotlin/src/lib.rs#L59
warning: unused variable: `tag`
--> specta-kotlin/src/lib.rs:59:17
|
59 | let tag = s.tag();
| ^^^ help: if this is intentional, prefix it with an underscore: `_tag`
|
unused variable: `fields`:
specta-kotlin/src/lib.rs#L58
warning: unused variable: `fields`
--> specta-kotlin/src/lib.rs:58:17
|
58 | let fields = s.fields();
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_fields`
|
unused variable: `generics`:
specta-kotlin/src/lib.rs#L57
warning: unused variable: `generics`
--> specta-kotlin/src/lib.rs:57:17
|
57 | let generics = s.generics();
| ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_generics`
|
unused variable: `name`:
specta-kotlin/src/lib.rs#L56
warning: unused variable: `name`
--> specta-kotlin/src/lib.rs:56:17
|
56 | let name = s.name();
| ^^^^ help: if this is intentional, prefix it with an underscore: `_name`
|
= note: `#[warn(unused_variables)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
specta-util/src/type_collection.rs#L36
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> specta-util/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:
specta-util/src/type_collection.rs#L11
warning: this `impl` can be derived
--> specta-util/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 {
|
|
module has the same name as its containing module:
specta-util/src/export/mod.rs#L1
warning: module has the same name as its containing module
--> specta-util/src/export/mod.rs:1:1
|
1 | mod export;
| ^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_inception
note: the lint level is defined here
--> specta-util/src/lib.rs:2:9
|
2 | #![warn(clippy::all, clippy::unwrap_used, clippy::panic)] // TODO: missing_docs
| ^^^^^^^^^^^
= note: `#[warn(clippy::module_inception)]` implied by `#[warn(clippy::all)]`
|
function `register_ty` is never used:
specta-util/src/export/export.rs#L40
warning: function `register_ty` is never used
--> specta-util/src/export/export.rs:40:8
|
40 | pub fn register_ty<T: Type>() {
| ^^^^^^^^^^^
|
function `get_types` is never used:
specta-util/src/export/export.rs#L29
warning: function `get_types` is never used
--> specta-util/src/export/export.rs:29:8
|
29 | pub fn get_types() -> TypesIter {
| ^^^^^^^^^
|
static `TYPES` is never used:
specta-util/src/export/export.rs#L6
warning: static `TYPES` is never used
--> specta-util/src/export/export.rs:6:8
|
6 | static TYPES: Lazy<RwLock<TypeMap>> = Lazy::new(Default::default);
| ^^^^^
|
= note: `#[warn(dead_code)]` on by default
|
this expression creates a reference which is immediately dereferenced by the compiler:
specta-swift/src/lib.rs#L45
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> specta-swift/src/lib.rs:45:82
|
45 | DataType::Map(t) => format!("[{}: {}]", datatype(&t.key_ty())?, datatype(&t.value_ty())?),
| ^^^^^^^^^^^^^ help: change this to: `t.value_ty()`
|
= 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:
specta-swift/src/lib.rs#L45
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> specta-swift/src/lib.rs:45:58
|
45 | DataType::Map(t) => format!("[{}: {}]", datatype(&t.key_ty())?, datatype(&t.value_ty())?),
| ^^^^^^^^^^^ help: change this to: `t.key_ty()`
|
= 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:
specta-swift/src/lib.rs#L33
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> specta-swift/src/lib.rs:33:55
|
33 | DataType::List(t) => format!("[{}]", datatype(&t.ty())?),
| ^^^^^^^ help: change this to: `t.ty()`
|
= 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
|
unused variable: `s`:
specta-swift/src/lib.rs#L60
warning: unused variable: `s`
--> specta-swift/src/lib.rs:60:26
|
60 | DataType::Struct(s) => {
| ^ help: if this is intentional, prefix it with an underscore: `_s`
|
= note: `#[warn(unused_variables)]` on by default
|
unused variable: `t`:
specta-go/src/lib.rs#L8
warning: unused variable: `t`
--> specta-go/src/lib.rs:8:13
|
8 | fn datatype(t: &DataType) -> Result<String, String> {
| ^ help: if this is intentional, prefix it with an underscore: `_t`
|
= note: `#[warn(unused_variables)]` on by default
|
unused import: `reference`:
specta-swift/src/lib.rs#L3
warning: unused import: `reference`
--> specta-swift/src/lib.rs:3:14
|
3 | use specta::{reference, DataType, Generics, PrimitiveType, Type, TypeMap};
| ^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
|
accessing first element with `generics.get(0)`:
specta/src/type/impls.rs#L165
warning: accessing first element with `generics.get(0)`
--> 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)`:
specta/src/type/impls.rs#L153
warning: accessing first element with `generics.get(0)`
--> 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)]`
|
unnecessary use of `get(&sid).is_none()`:
specta/src/datatype/reference.rs#L22
warning: unnecessary use of `get(&sid).is_none()`
--> 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):
specta/src/internal.rs#L238
warning: this function has too many arguments (8/7)
--> specta/src/internal.rs:238:5
|
238 | / pub fn get_fn_datatype<TMarker, T: Function<TMarker>>(
239 | | _: T,
240 | | asyncness: bool,
241 | | name: Cow<'static, str>,
... |
246 | | no_return_type: bool,
247 | | ) -> 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:
specta/src/internal/interop.rs#L344
warning: `panic` should not be present in production code
--> 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:
specta/src/internal/interop.rs#L44
warning: `panic` should not be present in production code
--> 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:
specta/src/internal/interop.rs#L13
warning: `panic` should not be present in production code
--> 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
--> specta/src/lib.rs:3:43
|
3 | #![warn(clippy::all, clippy::unwrap_used, clippy::panic)] // TODO: missing_docs
| ^^^^^^^^^^^^^
|
needless `fn main` in doctest:
specta/src/./docs.md#L22
warning: needless `fn main` in doctest
--> 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
--> 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)]`
|
unused variable: `name`:
specta/src/internal/interop.rs#L112
warning: unused variable: `name`
--> 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
|
useless conversion to the same type: `proc_macro2::TokenStream`:
specta-macros/src/utils.rs#L206
warning: useless conversion to the same type: `proc_macro2::TokenStream`
--> 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
|
this expression creates a reference which is immediately dereferenced by the compiler:
specta-macros/src/type/generics.rs#L241
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> 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:
specta-macros/src/type/generics.rs#L192
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> 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:
specta-macros/src/type/generics.rs#L169
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> 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:
specta-macros/src/type/generics.rs#L151
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> 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:
specta-macros/src/type/generics.rs#L131
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> 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():
specta-macros/src/type/attr/variant.rs#L32
warning: field assignment outside of initializer for an instance created with Default::default()
--> 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
--> 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:
specta-macros/src/utils.rs#L218
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> specta-macros/src/utils.rs:218:24
|
218 | attrs: &mut Vec<crate::utils::Attribute>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
|
::: 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():
specta-macros/src/type/attr/field.rs#L54
warning: field assignment outside of initializer for an instance created with Default::default()
--> 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
--> 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:
specta-macros/src/utils.rs#L218
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> specta-macros/src/utils.rs:218:24
|
218 | attrs: &mut Vec<crate::utils::Attribute>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
|
::: 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:
specta-macros/src/utils.rs#L218
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> specta-macros/src/utils.rs:218:24
|
218 | attrs: &mut Vec<crate::utils::Attribute>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
|
::: 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():
specta-macros/src/type/attr/container.rs#L54
warning: field assignment outside of initializer for an instance created with Default::default()
--> 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
--> 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
|
useless conversion to the same type: `proc_macro2::TokenStream`:
specta-datatype-from/src/utils.rs#L208
warning: useless conversion to the same type: `proc_macro2::TokenStream`
--> specta-datatype-from/src/utils.rs:208:55
|
208 | 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
|
writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do:
specta-macros/src/utils.rs#L218
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> specta-macros/src/utils.rs:218:24
|
218 | attrs: &mut Vec<crate::utils::Attribute>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
|
::: 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:
specta-macros/src/type/attr/common.rs#L75
warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
--> 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:
specta-macros/src/type/attr/common.rs#L61
warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
--> 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:
specta-macros/src/type/attr/common.rs#L46
warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
--> 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:
specta-macros/src/type/attr/common.rs#L38
warning: calling `push_str()` using a single-character string literal
--> 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:
specta-macros/src/type/attr/common.rs#L32
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> 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
= note: `#[warn(clippy::ptr_arg)]` on by default
|
redundant pattern matching, consider using `is_some()`:
specta-macros/src/specta.rs#L40
warning: redundant pattern matching, consider using `is_some()`
--> specta-macros/src/specta.rs:40:30
|
40 | let function_asyncness = match function.sig.asyncness {
| ______________________________^
41 | | Some(_) => true,
42 | | None => false,
43 | | };
| |_____^ 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:
specta-datatype-from/src/data_type_from/mod.rs#L24
warning: length comparison to zero
--> specta-datatype-from/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:
specta-datatype-from/src/utils.rs#L221
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> specta-datatype-from/src/utils.rs:221:24
|
221 | attrs: &mut Vec<crate::utils::Attribute>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
|
::: specta-datatype-from/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:
specta-datatype-from/src/utils.rs#L221
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> specta-datatype-from/src/utils.rs:221:24
|
221 | attrs: &mut Vec<crate::utils::Attribute>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
|
::: specta-datatype-from/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)
|
function `then_option` is never used:
specta-macros/src/utils.rs#L309
warning: function `then_option` is never used
--> specta-macros/src/utils.rs:309:8
|
309 | pub fn then_option(condition: bool, inner: TokenStream) -> TokenStream {
| ^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
|
method `apply` is never used:
specta-datatype-from/src/utils.rs#L291
warning: method `apply` is never used
--> specta-datatype-from/src/utils.rs:291:12
|
290 | impl Inflection {
| --------------- method in this implementation
291 | pub fn apply(self, string: &str) -> String {
| ^^^^^
|
enum `Inflection` is never used:
specta-datatype-from/src/utils.rs#L279
warning: enum `Inflection` is never used
--> specta-datatype-from/src/utils.rs:279:10
|
279 | pub enum Inflection {
| ^^^^^^^^^^
|
= note: `Inflection` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis
|
function `unraw_raw_ident` is never used:
specta-datatype-from/src/utils.rs#L269
warning: function `unraw_raw_ident` is never used
--> specta-datatype-from/src/utils.rs:269:8
|
269 | pub fn unraw_raw_ident(ident: &Ident) -> String {
| ^^^^^^^^^^^^^^^
|
methods `parse_bool` and `parse_inflection` are never used:
specta-datatype-from/src/utils.rs#L72
warning: methods `parse_bool` and `parse_inflection` are never used
--> specta-datatype-from/src/utils.rs:72:12
|
52 | impl Attribute {
| -------------- methods in this implementation
...
72 | pub fn parse_bool(&self) -> Result<bool> {
| ^^^^^^^^^^
...
92 | pub fn parse_inflection(&self) -> Result<Inflection> {
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
|
unused variable: `generic_params`:
specta-macros/src/type/mod.rs#L113
warning: unused variable: `generic_params`
--> specta-macros/src/type/mod.rs:113:13
|
113 | let generic_params = generics
| ^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_generic_params`
|
unused variable: `export_fn_name`:
specta-macros/src/type/mod.rs#L111
warning: unused variable: `export_fn_name`
--> specta-macros/src/type/mod.rs:111:13
|
111 | let export_fn_name = format_ident!("__push_specta_type_{}", raw_ident);
| ^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_export_fn_name`
|
unused variable: `internal_crate_ref`:
specta-macros/src/type/mod.rs#L42
warning: unused variable: `internal_crate_ref`
--> specta-macros/src/type/mod.rs:42:9
|
42 | let internal_crate_ref: TokenStream = quote!(specta_util); // TODO: This should be overridable by attribute but it's not. // TODO: co...
| ^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_internal_crate_ref`
|
= note: `#[warn(unused_variables)]` on by default
|
`#[macro_use]` only has an effect on `extern crate` and modules:
specta-datatype-from/src/utils.rs#L215
warning: `#[macro_use]` only has an effect on `extern crate` and modules
--> specta-datatype-from/src/utils.rs:215:1
|
215 | #[macro_use]
| ^^^^^^^^^^^^
|
= note: `#[warn(unused_attributes)]` on by default
|
useless conversion to the same type: `proc_macro2::TokenStream`:
specta-macros/src/utils.rs#L206
warning: useless conversion to the same type: `proc_macro2::TokenStream`
--> 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
|
this expression creates a reference which is immediately dereferenced by the compiler:
specta-macros/src/type/generics.rs#L241
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> 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:
specta-macros/src/type/generics.rs#L192
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> 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:
specta-macros/src/type/generics.rs#L169
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> 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:
specta-macros/src/type/generics.rs#L151
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> 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:
specta-macros/src/type/generics.rs#L131
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> 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():
specta-macros/src/type/attr/variant.rs#L32
warning: field assignment outside of initializer for an instance created with Default::default()
--> 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
--> 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:
specta-macros/src/utils.rs#L218
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> specta-macros/src/utils.rs:218:24
|
218 | attrs: &mut Vec<crate::utils::Attribute>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
|
::: 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():
specta-macros/src/type/attr/field.rs#L54
warning: field assignment outside of initializer for an instance created with Default::default()
--> 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
--> 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:
specta-macros/src/utils.rs#L218
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> specta-macros/src/utils.rs:218:24
|
218 | attrs: &mut Vec<crate::utils::Attribute>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
|
::: 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:
specta-macros/src/utils.rs#L218
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> specta-macros/src/utils.rs:218:24
|
218 | attrs: &mut Vec<crate::utils::Attribute>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
|
::: 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():
specta-macros/src/type/attr/container.rs#L54
warning: field assignment outside of initializer for an instance created with Default::default()
--> 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
--> 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:
specta-macros/src/utils.rs#L218
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> specta-macros/src/utils.rs:218:24
|
218 | attrs: &mut Vec<crate::utils::Attribute>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&mut [crate::utils::Attribute]`
|
::: 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:
specta-macros/src/type/attr/common.rs#L75
warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
--> 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:
specta-macros/src/type/attr/common.rs#L61
warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
--> 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:
specta-macros/src/type/attr/common.rs#L46
warning: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
--> 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:
specta-macros/src/type/attr/common.rs#L38
warning: calling `push_str()` using a single-character string literal
--> 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:
specta-macros/src/type/attr/common.rs#L32
warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
--> 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
= note: `#[warn(clippy::ptr_arg)]` on by default
|
redundant pattern matching, consider using `is_some()`:
specta-macros/src/specta.rs#L40
warning: redundant pattern matching, consider using `is_some()`
--> specta-macros/src/specta.rs:40:30
|
40 | let function_asyncness = match function.sig.asyncness {
| ______________________________^
41 | | Some(_) => true,
42 | | None => false,
43 | | };
| |_____^ 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
|
function `then_option` is never used:
specta-macros/src/utils.rs#L309
warning: function `then_option` is never used
--> specta-macros/src/utils.rs:309:8
|
309 | pub fn then_option(condition: bool, inner: TokenStream) -> TokenStream {
| ^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
|
unused variable: `generic_params`:
specta-macros/src/type/mod.rs#L113
warning: unused variable: `generic_params`
--> specta-macros/src/type/mod.rs:113:13
|
113 | let generic_params = generics
| ^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_generic_params`
|
unused variable: `export_fn_name`:
specta-macros/src/type/mod.rs#L111
warning: unused variable: `export_fn_name`
--> specta-macros/src/type/mod.rs:111:13
|
111 | let export_fn_name = format_ident!("__push_specta_type_{}", raw_ident);
| ^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_export_fn_name`
|
unused variable: `internal_crate_ref`:
specta-macros/src/type/mod.rs#L42
warning: unused variable: `internal_crate_ref`
--> specta-macros/src/type/mod.rs:42:9
|
42 | let internal_crate_ref: TokenStream = quote!(specta_util); // TODO: This should be overridable by attribute but it's not. // TODO: co...
| ^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_internal_crate_ref`
|
= note: `#[warn(unused_variables)]` 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/
|