Upgrade workspace (including syn v2) #407
clippy
110 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 110 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.79.0 (129f3b996 2024-06-10)
- cargo 1.79.0 (ffa9cf99a 2024-06-03)
- clippy 0.1.79 (129f3b9 2024-06-10)
Annotations
Check warning on line 112 in specta-zod/src/lib.rs
github-actions / clippy
this expression always evaluates to true
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
Check warning on line 8 in specta-zod/src/context.rs
github-actions / clippy
field `0` is never read
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),
| ~~
Check warning on line 789 in specta-typescript/src/lib.rs
github-actions / clippy
passing a unit value to a function
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(())
|
Check warning on line 506 in specta-typescript/src/lib.rs
github-actions / clippy
passing a unit value to a function
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 ~ };
|
Check warning on line 563 in specta-typescript/src/lib.rs
github-actions / clippy
passing a unit value to a function
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(())
|
Check warning on line 465 in specta-typescript/src/lib.rs
github-actions / clippy
passing a unit value to a function
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(())
|
Check warning on line 402 in specta-typescript/src/lib.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> 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
Check warning on line 400 in specta-typescript/src/lib.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> 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
Check warning on line 327 in specta-typescript/src/lib.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> 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
Check warning on line 422 in specta-typescript/src/lib.rs
github-actions / clippy
passing a unit value to a function
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(())
|
Check warning on line 213 in specta-typescript/src/lib.rs
github-actions / clippy
using `clone` on type `Option<&NamedDataTypeExt>` which implements the `Copy` trait
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
Check warning on line 175 in specta-typescript/src/lib.rs
github-actions / clippy
calling `push_str()` using a single-character string literal
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
Check warning on line 168 in specta-typescript/src/lib.rs
github-actions / clippy
calling `push_str()` using a single-character string literal
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
Check warning on line 158 in specta-typescript/src/lib.rs
github-actions / clippy
calling `push_str()` using a single-character string literal
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
Check warning on line 66 in specta-typescript/src/reserved_terms.rs
github-actions / clippy
constant `RESERVED_IDENTS` is never used
warning: constant `RESERVED_IDENTS` is never used
--> specta-typescript/src/reserved_terms.rs:66:18
|
66 | pub(crate) const RESERVED_IDENTS: &[&str] = &[
| ^^^^^^^^^^^^^^^
Check warning on line 98 in specta-typescript/src/js_doc.rs
github-actions / clippy
method `push_generic` is never used
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) {
| ^^^^^^^^^^^^
Check warning on line 24 in specta-typescript/src/js_doc.rs
github-actions / clippy
function `typedef_named_datatype_inner` is never used
warning: function `typedef_named_datatype_inner` is never used
--> specta-typescript/src/js_doc.rs:24:4
|
24 | fn typedef_named_datatype_inner(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Check warning on line 7 in specta-typescript/src/js_doc.rs
github-actions / clippy
function `typedef_named_datatype` is never used
warning: function `typedef_named_datatype` is never used
--> specta-typescript/src/js_doc.rs:7:8
|
7 | pub fn typedef_named_datatype(
| ^^^^^^^^^^^^^^^^^^^^^^
Check warning on line 10 in specta-typescript/src/context.rs
github-actions / clippy
field `0` is never read
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),
| ~~
Check warning on line 4 in specta-typescript/src/lib.rs
github-actions / clippy
unused import: `fmt::Display`
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
Check warning on line 33 in specta-rust/src/lib.rs
github-actions / clippy
redundant closure
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
Check warning on line 24 in specta-rust/src/lib.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> 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
Check warning on line 23 in specta-rust/src/lib.rs
github-actions / clippy
this expression creates a reference which is immediately dereferenced by the compiler
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> 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
Check warning on line 38 in specta-rust/src/lib.rs
github-actions / clippy
unused variable: `s`
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
Check warning on line 88 in specta-openapi/src/lib.rs
github-actions / clippy
returning the result of a `let` binding from a block
warning: returning the result of a `let` binding from a block
--> specta-openapi/src/lib.rs:88:13
|
86 | let schema = to_openapi(def);
| ----------------------------- unnecessary `let` binding
87 | // schema.schema_data.nullable = true; // TODO
88 | 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
|
86 ~
87 | // schema.schema_data.nullable = true; // TODO
88 ~ to_openapi(def)
|