Auto merge of #118297 - shepmaster:warn-dead-tuple-fields, r=WaffleLapkin
Merge `unused_tuple_struct_fields` into `dead_code` This implicitly upgrades the lint from `allow` to `warn` and places it into the `unused` lint group. [Discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Moving.20.60unused_tuple_struct_fields.60.20from.20allow.20to.20warn)
This commit is contained in:
commit
5113ed28ea
227 changed files with 406 additions and 412 deletions
|
|
@ -22,7 +22,7 @@ pub(super) enum Op<'a> {
|
|||
|
||||
// rm `.cloned()`
|
||||
// e.g. `map` `for_each` `all` `any`
|
||||
NeedlessMove(&'a str, &'a Expr<'a>),
|
||||
NeedlessMove(&'a Expr<'a>),
|
||||
|
||||
// later `.cloned()`
|
||||
// and add `&` to the parameter of closure parameter
|
||||
|
|
@ -59,7 +59,7 @@ pub(super) fn check<'tcx>(
|
|||
return;
|
||||
}
|
||||
|
||||
if let Op::NeedlessMove(_, expr) = op {
|
||||
if let Op::NeedlessMove(expr) = op {
|
||||
let rustc_hir::ExprKind::Closure(closure) = expr.kind else {
|
||||
return;
|
||||
};
|
||||
|
|
@ -104,7 +104,7 @@ pub(super) fn check<'tcx>(
|
|||
}
|
||||
|
||||
let (lint, msg, trailing_clone) = match op {
|
||||
Op::RmCloned | Op::NeedlessMove(_, _) => (REDUNDANT_CLONE, "unneeded cloning of iterator items", ""),
|
||||
Op::RmCloned | Op::NeedlessMove(_) => (REDUNDANT_CLONE, "unneeded cloning of iterator items", ""),
|
||||
Op::LaterCloned | Op::FixClosure(_, _) => (
|
||||
ITER_OVEREAGER_CLONED,
|
||||
"unnecessarily eager cloning of iterator items",
|
||||
|
|
@ -133,7 +133,7 @@ pub(super) fn check<'tcx>(
|
|||
diag.span_suggestion(replace_span, "try", snip, Applicability::MachineApplicable);
|
||||
}
|
||||
},
|
||||
Op::NeedlessMove(_, _) => {
|
||||
Op::NeedlessMove(_) => {
|
||||
let method_span = expr.span.with_lo(cloned_call.span.hi());
|
||||
if let Some(snip) = snippet_opt(cx, method_span) {
|
||||
let replace_span = expr.span.with_lo(cloned_recv.span.hi());
|
||||
|
|
|
|||
|
|
@ -4186,7 +4186,7 @@ impl Methods {
|
|||
expr,
|
||||
recv,
|
||||
recv2,
|
||||
iter_overeager_cloned::Op::NeedlessMove(name, arg),
|
||||
iter_overeager_cloned::Op::NeedlessMove(arg),
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
|
@ -4204,7 +4204,7 @@ impl Methods {
|
|||
expr,
|
||||
recv,
|
||||
recv2,
|
||||
iter_overeager_cloned::Op::NeedlessMove(name, arg),
|
||||
iter_overeager_cloned::Op::NeedlessMove(arg),
|
||||
false,
|
||||
),
|
||||
Some(("chars", recv, _, _, _))
|
||||
|
|
@ -4379,7 +4379,7 @@ impl Methods {
|
|||
expr,
|
||||
recv,
|
||||
recv2,
|
||||
iter_overeager_cloned::Op::NeedlessMove(name, arg),
|
||||
iter_overeager_cloned::Op::NeedlessMove(arg),
|
||||
false,
|
||||
),
|
||||
_ => {},
|
||||
|
|
@ -4433,7 +4433,7 @@ impl Methods {
|
|||
expr,
|
||||
recv,
|
||||
recv2,
|
||||
iter_overeager_cloned::Op::NeedlessMove(name, m_arg),
|
||||
iter_overeager_cloned::Op::NeedlessMove(m_arg),
|
||||
false,
|
||||
),
|
||||
_ => {},
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ enum IfBlockType<'hir> {
|
|||
Ty<'hir>,
|
||||
Symbol,
|
||||
&'hir Expr<'hir>,
|
||||
Option<&'hir Expr<'hir>>,
|
||||
),
|
||||
/// An `if let Xxx(a) = b { c } else { d }` expression.
|
||||
///
|
||||
|
|
@ -143,7 +142,7 @@ fn check_let_some_else_return_none(cx: &LateContext<'_>, stmt: &Stmt<'_>) {
|
|||
|
||||
fn is_early_return(smbl: Symbol, cx: &LateContext<'_>, if_block: &IfBlockType<'_>) -> bool {
|
||||
match *if_block {
|
||||
IfBlockType::IfIs(caller, caller_ty, call_sym, if_then, _) => {
|
||||
IfBlockType::IfIs(caller, caller_ty, call_sym, if_then) => {
|
||||
// If the block could be identified as `if x.is_none()/is_err()`,
|
||||
// we then only need to check the if_then return to see if it is none/err.
|
||||
is_type_diagnostic_item(cx, caller_ty, smbl)
|
||||
|
|
@ -235,7 +234,7 @@ impl QuestionMark {
|
|||
&& !is_else_clause(cx.tcx, expr)
|
||||
&& let ExprKind::MethodCall(segment, caller, ..) = &cond.kind
|
||||
&& let caller_ty = cx.typeck_results().expr_ty(caller)
|
||||
&& let if_block = IfBlockType::IfIs(caller, caller_ty, segment.ident.name, then, r#else)
|
||||
&& let if_block = IfBlockType::IfIs(caller, caller_ty, segment.ident.name, then)
|
||||
&& (is_early_return(sym::Option, cx, &if_block) || is_early_return(sym::Result, cx, &if_block))
|
||||
{
|
||||
let mut applicability = Applicability::MachineApplicable;
|
||||
|
|
|
|||
|
|
@ -26,18 +26,18 @@ pub(super) fn check<'tcx>(
|
|||
|
||||
// `Repr(C)` <-> unordered type.
|
||||
// If the first field of the `Repr(C)` type matches then the transmute is ok
|
||||
(ReducedTy::OrderedFields(_, Some(from_sub_ty)), ReducedTy::UnorderedFields(to_sub_ty))
|
||||
| (ReducedTy::UnorderedFields(from_sub_ty), ReducedTy::OrderedFields(_, Some(to_sub_ty))) => {
|
||||
(ReducedTy::OrderedFields(Some(from_sub_ty)), ReducedTy::UnorderedFields(to_sub_ty))
|
||||
| (ReducedTy::UnorderedFields(from_sub_ty), ReducedTy::OrderedFields(Some(to_sub_ty))) => {
|
||||
from_ty = from_sub_ty;
|
||||
to_ty = to_sub_ty;
|
||||
continue;
|
||||
},
|
||||
(ReducedTy::OrderedFields(_, Some(from_sub_ty)), ReducedTy::Other(to_sub_ty)) if reduced_tys.to_fat_ptr => {
|
||||
(ReducedTy::OrderedFields(Some(from_sub_ty)), ReducedTy::Other(to_sub_ty)) if reduced_tys.to_fat_ptr => {
|
||||
from_ty = from_sub_ty;
|
||||
to_ty = to_sub_ty;
|
||||
continue;
|
||||
},
|
||||
(ReducedTy::Other(from_sub_ty), ReducedTy::OrderedFields(_, Some(to_sub_ty)))
|
||||
(ReducedTy::Other(from_sub_ty), ReducedTy::OrderedFields(Some(to_sub_ty)))
|
||||
if reduced_tys.from_fat_ptr =>
|
||||
{
|
||||
from_ty = from_sub_ty;
|
||||
|
|
@ -235,8 +235,8 @@ enum ReducedTy<'tcx> {
|
|||
TypeErasure { raw_ptr_only: bool },
|
||||
/// The type is a struct containing either zero non-zero sized fields, or multiple non-zero
|
||||
/// sized fields with a defined order.
|
||||
/// The second value is the first non-zero sized type.
|
||||
OrderedFields(Ty<'tcx>, Option<Ty<'tcx>>),
|
||||
/// The value is the first non-zero sized type.
|
||||
OrderedFields(Option<Ty<'tcx>>),
|
||||
/// The type is a struct containing multiple non-zero sized fields with no defined order.
|
||||
UnorderedFields(Ty<'tcx>),
|
||||
/// Any other type.
|
||||
|
|
@ -259,7 +259,7 @@ fn reduce_ty<'tcx>(cx: &LateContext<'tcx>, mut ty: Ty<'tcx>) -> ReducedTy<'tcx>
|
|||
ty::Tuple(args) => {
|
||||
let mut iter = args.iter();
|
||||
let Some(sized_ty) = iter.find(|&ty| !is_zero_sized_ty(cx, ty)) else {
|
||||
return ReducedTy::OrderedFields(ty, None);
|
||||
return ReducedTy::OrderedFields(None);
|
||||
};
|
||||
if iter.all(|ty| is_zero_sized_ty(cx, ty)) {
|
||||
ty = sized_ty;
|
||||
|
|
@ -281,7 +281,7 @@ fn reduce_ty<'tcx>(cx: &LateContext<'tcx>, mut ty: Ty<'tcx>) -> ReducedTy<'tcx>
|
|||
continue;
|
||||
}
|
||||
if def.repr().inhibit_struct_field_reordering_opt() {
|
||||
ReducedTy::OrderedFields(ty, Some(sized_ty))
|
||||
ReducedTy::OrderedFields(Some(sized_ty))
|
||||
} else {
|
||||
ReducedTy::UnorderedFields(ty)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
// As the most common case is the `http` crate, it replicates `http::HeaderName`'s structure.
|
||||
|
||||
#![allow(clippy::declare_interior_mutable_const)]
|
||||
#![allow(unused_tuple_struct_fields)]
|
||||
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#![warn(clippy::useless_format)]
|
||||
#![allow(
|
||||
unused_tuple_struct_fields,
|
||||
clippy::print_literal,
|
||||
clippy::redundant_clone,
|
||||
clippy::to_string_in_format_args,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#![warn(clippy::useless_format)]
|
||||
#![allow(
|
||||
unused_tuple_struct_fields,
|
||||
clippy::print_literal,
|
||||
clippy::redundant_clone,
|
||||
clippy::to_string_in_format_args,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:20:5
|
||||
--> $DIR/format.rs:19:5
|
||||
|
|
||||
LL | format!("foo");
|
||||
| ^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"foo".to_string()`
|
||||
|
|
@ -8,19 +8,19 @@ LL | format!("foo");
|
|||
= help: to override `-D warnings` add `#[allow(clippy::useless_format)]`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:21:5
|
||||
--> $DIR/format.rs:20:5
|
||||
|
|
||||
LL | format!("{{}}");
|
||||
| ^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"{}".to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:22:5
|
||||
--> $DIR/format.rs:21:5
|
||||
|
|
||||
LL | format!("{{}} abc {{}}");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"{} abc {}".to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:23:5
|
||||
--> $DIR/format.rs:22:5
|
||||
|
|
||||
LL | / format!(
|
||||
LL | | r##"foo {{}}
|
||||
|
|
@ -35,67 +35,67 @@ LL ~ " bar"##.to_string();
|
|||
|
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:28:13
|
||||
--> $DIR/format.rs:27:13
|
||||
|
|
||||
LL | let _ = format!("");
|
||||
| ^^^^^^^^^^^ help: consider using `String::new()`: `String::new()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:30:5
|
||||
--> $DIR/format.rs:29:5
|
||||
|
|
||||
LL | format!("{}", "foo");
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"foo".to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:38:5
|
||||
--> $DIR/format.rs:37:5
|
||||
|
|
||||
LL | format!("{}", arg);
|
||||
| ^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `arg.to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:68:5
|
||||
--> $DIR/format.rs:67:5
|
||||
|
|
||||
LL | format!("{}", 42.to_string());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `42.to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:70:5
|
||||
--> $DIR/format.rs:69:5
|
||||
|
|
||||
LL | format!("{}", x.display().to_string());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `x.display().to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:74:18
|
||||
--> $DIR/format.rs:73:18
|
||||
|
|
||||
LL | let _ = Some(format!("{}", a + "bar"));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `a + "bar"`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:78:22
|
||||
--> $DIR/format.rs:77:22
|
||||
|
|
||||
LL | let _s: String = format!("{}", &*v.join("\n"));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `(&*v.join("\n")).to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:84:13
|
||||
--> $DIR/format.rs:83:13
|
||||
|
|
||||
LL | let _ = format!("{x}");
|
||||
| ^^^^^^^^^^^^^^ help: consider using `.to_string()`: `x.to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:86:13
|
||||
--> $DIR/format.rs:85:13
|
||||
|
|
||||
LL | let _ = format!("{y}", y = x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `x.to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:90:13
|
||||
--> $DIR/format.rs:89:13
|
||||
|
|
||||
LL | let _ = format!("{abc}");
|
||||
| ^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `abc.to_string()`
|
||||
|
||||
error: useless use of `format!`
|
||||
--> $DIR/format.rs:92:13
|
||||
--> $DIR/format.rs:91:13
|
||||
|
|
||||
LL | let _ = format!("{xx}");
|
||||
| ^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `xx.to_string()`
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#![warn(clippy::from_iter_instead_of_collect)]
|
||||
#![allow(unused_imports, unused_tuple_struct_fields)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
use std::collections::{BTreeMap, BTreeSet, HashMap, VecDeque};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#![warn(clippy::from_iter_instead_of_collect)]
|
||||
#![allow(unused_imports, unused_tuple_struct_fields)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(clippy::useless_vec)]
|
||||
|
||||
use std::collections::{BTreeMap, BTreeSet, HashMap, VecDeque};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#![feature(never_type)]
|
||||
#![allow(
|
||||
unused_mut,
|
||||
unused_tuple_struct_fields,
|
||||
clippy::redundant_allocation,
|
||||
clippy::needless_pass_by_ref_mut
|
||||
)]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#![feature(never_type)]
|
||||
#![allow(
|
||||
unused_mut,
|
||||
unused_tuple_struct_fields,
|
||||
clippy::redundant_allocation,
|
||||
clippy::needless_pass_by_ref_mut
|
||||
)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: this function could have a `#[must_use]` attribute
|
||||
--> $DIR/must_use_candidates.rs:16:1
|
||||
--> $DIR/must_use_candidates.rs:15:1
|
||||
|
|
||||
LL | pub fn pure(i: u8) -> u8 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn pure(i: u8) -> u8`
|
||||
|
|
@ -8,25 +8,25 @@ LL | pub fn pure(i: u8) -> u8 {
|
|||
= help: to override `-D warnings` add `#[allow(clippy::must_use_candidate)]`
|
||||
|
||||
error: this method could have a `#[must_use]` attribute
|
||||
--> $DIR/must_use_candidates.rs:21:5
|
||||
--> $DIR/must_use_candidates.rs:20:5
|
||||
|
|
||||
LL | pub fn inherent_pure(&self) -> u8 {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn inherent_pure(&self) -> u8`
|
||||
|
||||
error: this function could have a `#[must_use]` attribute
|
||||
--> $DIR/must_use_candidates.rs:52:1
|
||||
--> $DIR/must_use_candidates.rs:51:1
|
||||
|
|
||||
LL | pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool`
|
||||
|
||||
error: this function could have a `#[must_use]` attribute
|
||||
--> $DIR/must_use_candidates.rs:64:1
|
||||
--> $DIR/must_use_candidates.rs:63:1
|
||||
|
|
||||
LL | pub fn rcd(_x: Rc<u32>) -> bool {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn rcd(_x: Rc<u32>) -> bool`
|
||||
|
||||
error: this function could have a `#[must_use]` attribute
|
||||
--> $DIR/must_use_candidates.rs:72:1
|
||||
--> $DIR/must_use_candidates.rs:71:1
|
||||
|
|
||||
LL | pub fn arcd(_x: Arc<u32>) -> bool {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn arcd(_x: Arc<u32>) -> bool`
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#![warn(clippy::init_numbered_fields)]
|
||||
#![allow(unused_tuple_struct_fields)]
|
||||
|
||||
#[derive(Default)]
|
||||
struct TupleStruct(u32, u32, u8);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#![warn(clippy::init_numbered_fields)]
|
||||
#![allow(unused_tuple_struct_fields)]
|
||||
|
||||
#[derive(Default)]
|
||||
struct TupleStruct(u32, u32, u8);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: used a field initializer for a tuple struct
|
||||
--> $DIR/numbered_fields.rs:18:13
|
||||
--> $DIR/numbered_fields.rs:17:13
|
||||
|
|
||||
LL | let _ = TupleStruct {
|
||||
| _____________^
|
||||
|
|
@ -13,7 +13,7 @@ LL | | };
|
|||
= help: to override `-D warnings` add `#[allow(clippy::init_numbered_fields)]`
|
||||
|
||||
error: used a field initializer for a tuple struct
|
||||
--> $DIR/numbered_fields.rs:25:13
|
||||
--> $DIR/numbered_fields.rs:24:13
|
||||
|
|
||||
LL | let _ = TupleStruct {
|
||||
| _____________^
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#![warn(clippy::option_if_let_else)]
|
||||
#![allow(
|
||||
unused_tuple_struct_fields,
|
||||
clippy::ref_option_ref,
|
||||
clippy::equatable_if_let,
|
||||
clippy::let_unit_value,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#![warn(clippy::option_if_let_else)]
|
||||
#![allow(
|
||||
unused_tuple_struct_fields,
|
||||
clippy::ref_option_ref,
|
||||
clippy::equatable_if_let,
|
||||
clippy::let_unit_value,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:11:5
|
||||
--> $DIR/option_if_let_else.rs:10:5
|
||||
|
|
||||
LL | / if let Some(x) = string {
|
||||
LL | | (true, x)
|
||||
|
|
@ -12,19 +12,19 @@ LL | | }
|
|||
= help: to override `-D warnings` add `#[allow(clippy::option_if_let_else)]`
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:29:13
|
||||
--> $DIR/option_if_let_else.rs:28:13
|
||||
|
|
||||
LL | let _ = if let Some(s) = *string { s.len() } else { 0 };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `string.map_or(0, |s| s.len())`
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:30:13
|
||||
--> $DIR/option_if_let_else.rs:29:13
|
||||
|
|
||||
LL | let _ = if let Some(s) = &num { s } else { &0 };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)`
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:31:13
|
||||
--> $DIR/option_if_let_else.rs:30:13
|
||||
|
|
||||
LL | let _ = if let Some(s) = &mut num {
|
||||
| _____________^
|
||||
|
|
@ -44,13 +44,13 @@ LL ~ });
|
|||
|
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:37:13
|
||||
--> $DIR/option_if_let_else.rs:36:13
|
||||
|
|
||||
LL | let _ = if let Some(ref s) = num { s } else { &0 };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `num.as_ref().map_or(&0, |s| s)`
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:38:13
|
||||
--> $DIR/option_if_let_else.rs:37:13
|
||||
|
|
||||
LL | let _ = if let Some(mut s) = num {
|
||||
| _____________^
|
||||
|
|
@ -70,7 +70,7 @@ LL ~ });
|
|||
|
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:44:13
|
||||
--> $DIR/option_if_let_else.rs:43:13
|
||||
|
|
||||
LL | let _ = if let Some(ref mut s) = num {
|
||||
| _____________^
|
||||
|
|
@ -90,7 +90,7 @@ LL ~ });
|
|||
|
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:53:5
|
||||
--> $DIR/option_if_let_else.rs:52:5
|
||||
|
|
||||
LL | / if let Some(x) = arg {
|
||||
LL | | let y = x * x;
|
||||
|
|
@ -109,7 +109,7 @@ LL + })
|
|||
|
|
||||
|
||||
error: use Option::map_or_else instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:66:13
|
||||
--> $DIR/option_if_let_else.rs:65:13
|
||||
|
|
||||
LL | let _ = if let Some(x) = arg {
|
||||
| _____________^
|
||||
|
|
@ -121,7 +121,7 @@ LL | | };
|
|||
| |_____^ help: try: `arg.map_or_else(side_effect, |x| x)`
|
||||
|
||||
error: use Option::map_or_else instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:75:13
|
||||
--> $DIR/option_if_let_else.rs:74:13
|
||||
|
|
||||
LL | let _ = if let Some(x) = arg {
|
||||
| _____________^
|
||||
|
|
@ -144,7 +144,7 @@ LL ~ }, |x| x * x * x * x);
|
|||
|
|
||||
|
||||
error: use Option::map_or_else instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:108:13
|
||||
--> $DIR/option_if_let_else.rs:107:13
|
||||
|
|
||||
LL | / if let Some(idx) = s.find('.') {
|
||||
LL | | vec![s[..idx].to_string(), s[idx..].to_string()]
|
||||
|
|
@ -154,7 +154,7 @@ LL | | }
|
|||
| |_____________^ help: try: `s.find('.').map_or_else(|| vec![s.to_string()], |idx| vec![s[..idx].to_string(), s[idx..].to_string()])`
|
||||
|
||||
error: use Option::map_or_else instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:119:5
|
||||
--> $DIR/option_if_let_else.rs:118:5
|
||||
|
|
||||
LL | / if let Ok(binding) = variable {
|
||||
LL | | println!("Ok {binding}");
|
||||
|
|
@ -177,13 +177,13 @@ LL + })
|
|||
|
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:143:13
|
||||
--> $DIR/option_if_let_else.rs:142:13
|
||||
|
|
||||
LL | let _ = if let Some(x) = optional { x + 2 } else { 5 };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `optional.map_or(5, |x| x + 2)`
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:153:13
|
||||
--> $DIR/option_if_let_else.rs:152:13
|
||||
|
|
||||
LL | let _ = if let Some(x) = Some(0) {
|
||||
| _____________^
|
||||
|
|
@ -205,13 +205,13 @@ LL ~ });
|
|||
|
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:181:13
|
||||
--> $DIR/option_if_let_else.rs:180:13
|
||||
|
|
||||
LL | let _ = if let Some(x) = Some(0) { s.len() + x } else { s.len() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(0).map_or(s.len(), |x| s.len() + x)`
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:185:13
|
||||
--> $DIR/option_if_let_else.rs:184:13
|
||||
|
|
||||
LL | let _ = if let Some(x) = Some(0) {
|
||||
| _____________^
|
||||
|
|
@ -231,7 +231,7 @@ LL ~ });
|
|||
|
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:224:13
|
||||
--> $DIR/option_if_let_else.rs:223:13
|
||||
|
|
||||
LL | let _ = match s {
|
||||
| _____________^
|
||||
|
|
@ -241,7 +241,7 @@ LL | | };
|
|||
| |_____^ help: try: `s.map_or(1, |string| string.len())`
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:228:13
|
||||
--> $DIR/option_if_let_else.rs:227:13
|
||||
|
|
||||
LL | let _ = match Some(10) {
|
||||
| _____________^
|
||||
|
|
@ -251,7 +251,7 @@ LL | | };
|
|||
| |_____^ help: try: `Some(10).map_or(5, |a| a + 1)`
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:234:13
|
||||
--> $DIR/option_if_let_else.rs:233:13
|
||||
|
|
||||
LL | let _ = match res {
|
||||
| _____________^
|
||||
|
|
@ -261,7 +261,7 @@ LL | | };
|
|||
| |_____^ help: try: `res.map_or(1, |a| a + 1)`
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:238:13
|
||||
--> $DIR/option_if_let_else.rs:237:13
|
||||
|
|
||||
LL | let _ = match res {
|
||||
| _____________^
|
||||
|
|
@ -271,13 +271,13 @@ LL | | };
|
|||
| |_____^ help: try: `res.map_or(1, |a| a + 1)`
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:242:13
|
||||
--> $DIR/option_if_let_else.rs:241:13
|
||||
|
|
||||
LL | let _ = if let Ok(a) = res { a + 1 } else { 5 };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `res.map_or(5, |a| a + 1)`
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:259:17
|
||||
--> $DIR/option_if_let_else.rs:258:17
|
||||
|
|
||||
LL | let _ = match initial {
|
||||
| _________________^
|
||||
|
|
@ -287,7 +287,7 @@ LL | | };
|
|||
| |_________^ help: try: `initial.as_ref().map_or(42, |value| do_something(value))`
|
||||
|
||||
error: use Option::map_or instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:266:17
|
||||
--> $DIR/option_if_let_else.rs:265:17
|
||||
|
|
||||
LL | let _ = match initial {
|
||||
| _________________^
|
||||
|
|
@ -297,7 +297,7 @@ LL | | };
|
|||
| |_________^ help: try: `initial.as_mut().map_or(42, |value| do_something2(value))`
|
||||
|
||||
error: use Option::map_or_else instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:289:24
|
||||
--> $DIR/option_if_let_else.rs:288:24
|
||||
|
|
||||
LL | let mut _hashmap = if let Some(hm) = &opt {
|
||||
| ________________________^
|
||||
|
|
@ -308,7 +308,7 @@ LL | | };
|
|||
| |_____^ help: try: `opt.as_ref().map_or_else(HashMap::new, |hm| hm.clone())`
|
||||
|
||||
error: use Option::map_or_else instead of an if let/else
|
||||
--> $DIR/option_if_let_else.rs:295:19
|
||||
--> $DIR/option_if_let_else.rs:294:19
|
||||
|
|
||||
LL | let mut _hm = if let Some(hm) = &opt { hm.clone() } else { new_map!() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `opt.as_ref().map_or_else(|| new_map!(), |hm| hm.clone())`
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#![warn(clippy::unreadable_literal)]
|
||||
#![allow(unused_tuple_struct_fields)]
|
||||
|
||||
struct Foo(u64);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#![warn(clippy::unreadable_literal)]
|
||||
#![allow(unused_tuple_struct_fields)]
|
||||
|
||||
struct Foo(u64);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: long literal lacking separators
|
||||
--> $DIR/unreadable_literal.rs:32:17
|
||||
--> $DIR/unreadable_literal.rs:31:17
|
||||
|
|
||||
LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32);
|
||||
| ^^^^^^^^^^^^ help: consider: `0b11_0110_i64`
|
||||
|
|
@ -8,55 +8,55 @@ LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32);
|
|||
= help: to override `-D warnings` add `#[allow(clippy::unreadable_literal)]`
|
||||
|
||||
error: long literal lacking separators
|
||||
--> $DIR/unreadable_literal.rs:32:31
|
||||
--> $DIR/unreadable_literal.rs:31:31
|
||||
|
|
||||
LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32);
|
||||
| ^^^^^^^^^^^^^^^^ help: consider: `0x1234_5678_usize`
|
||||
|
||||
error: long literal lacking separators
|
||||
--> $DIR/unreadable_literal.rs:32:49
|
||||
--> $DIR/unreadable_literal.rs:31:49
|
||||
|
|
||||
LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32);
|
||||
| ^^^^^^^^^^ help: consider: `123_456_f32`
|
||||
|
||||
error: long literal lacking separators
|
||||
--> $DIR/unreadable_literal.rs:32:61
|
||||
--> $DIR/unreadable_literal.rs:31:61
|
||||
|
|
||||
LL | let _bad = (0b110110_i64, 0x12345678_usize, 123456_f32, 1.234567_f32);
|
||||
| ^^^^^^^^^^^^ help: consider: `1.234_567_f32`
|
||||
|
||||
error: long literal lacking separators
|
||||
--> $DIR/unreadable_literal.rs:34:20
|
||||
--> $DIR/unreadable_literal.rs:33:20
|
||||
|
|
||||
LL | let _bad_sci = 1.123456e1;
|
||||
| ^^^^^^^^^^ help: consider: `1.123_456e1`
|
||||
|
||||
error: long literal lacking separators
|
||||
--> $DIR/unreadable_literal.rs:36:18
|
||||
--> $DIR/unreadable_literal.rs:35:18
|
||||
|
|
||||
LL | let _fail1 = 0xabcdef;
|
||||
| ^^^^^^^^ help: consider: `0x00ab_cdef`
|
||||
|
||||
error: long literal lacking separators
|
||||
--> $DIR/unreadable_literal.rs:37:23
|
||||
--> $DIR/unreadable_literal.rs:36:23
|
||||
|
|
||||
LL | let _fail2: u32 = 0xBAFEBAFE;
|
||||
| ^^^^^^^^^^ help: consider: `0xBAFE_BAFE`
|
||||
|
||||
error: long literal lacking separators
|
||||
--> $DIR/unreadable_literal.rs:38:18
|
||||
--> $DIR/unreadable_literal.rs:37:18
|
||||
|
|
||||
LL | let _fail3 = 0xabcdeff;
|
||||
| ^^^^^^^^^ help: consider: `0x0abc_deff`
|
||||
|
||||
error: long literal lacking separators
|
||||
--> $DIR/unreadable_literal.rs:39:24
|
||||
--> $DIR/unreadable_literal.rs:38:24
|
||||
|
|
||||
LL | let _fail4: i128 = 0xabcabcabcabcabcabc;
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: consider: `0x00ab_cabc_abca_bcab_cabc`
|
||||
|
||||
error: long literal lacking separators
|
||||
--> $DIR/unreadable_literal.rs:40:18
|
||||
--> $DIR/unreadable_literal.rs:39:18
|
||||
|
|
||||
LL | let _fail5 = 1.100300400;
|
||||
| ^^^^^^^^^^^ help: consider: `1.100_300_400`
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
//@[stack]error-in-other-file: which is strongly protected
|
||||
//@[tree]error-in-other-file: /deallocation through .* is forbidden/
|
||||
struct Newtype<'a>(&'a mut i32, i32);
|
||||
struct Newtype<'a>(#[allow(dead_code)] &'a mut i32, #[allow(dead_code)] i32);
|
||||
|
||||
fn dealloc_while_running(_n: Newtype<'_>, dealloc: impl FnOnce()) {
|
||||
dealloc();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
//@[stack]error-in-other-file: which is strongly protected
|
||||
//@[tree]error-in-other-file: /deallocation through .* is forbidden/
|
||||
|
||||
struct Newtype<'a>(&'a mut i32);
|
||||
struct Newtype<'a>(#[allow(dead_code)] &'a mut i32);
|
||||
|
||||
fn dealloc_while_running(_n: Newtype<'_>, dealloc: impl FnOnce()) {
|
||||
dealloc();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
use std::sync::atomic::{AtomicI64, Ordering};
|
||||
|
||||
#[repr(align(8))]
|
||||
struct AlignedI64(i64);
|
||||
struct AlignedI64(#[allow(dead_code)] i64);
|
||||
|
||||
fn main() {
|
||||
static X: AlignedI64 = AlignedI64(0);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// should find the bug even without retagging
|
||||
//@compile-flags: -Zmiri-disable-stacked-borrows
|
||||
|
||||
struct SliceWithHead(u8, [u8]);
|
||||
struct SliceWithHead(#[allow(dead_code)] u8, #[allow(dead_code)] [u8]);
|
||||
|
||||
fn main() {
|
||||
let buf = [0u32; 1];
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
// Some targets treat arrays and structs very differently. We would probably catch that on those
|
||||
// targets since we check the `PassMode`; here we ensure that we catch it on *all* targets
|
||||
// (in particular, on x86-64 the pass mode is `Indirect` for both of these).
|
||||
struct S(i32, i32, i32, i32);
|
||||
struct S(#[allow(dead_code)] i32, #[allow(dead_code)] i32, #[allow(dead_code)] i32, #[allow(dead_code)] i32);
|
||||
type A = [i32; 4];
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
trait Empty {}
|
||||
|
||||
#[repr(transparent)]
|
||||
pub struct FunnyPointer(dyn Empty);
|
||||
pub struct FunnyPointer(#[allow(dead_code)] dyn Empty);
|
||||
|
||||
#[repr(C)]
|
||||
pub struct Meta {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//@compile-flags: -Cdebug-assertions=no
|
||||
|
||||
#[repr(transparent)]
|
||||
struct HasDrop(u8);
|
||||
struct HasDrop(#[allow(dead_code)] u8);
|
||||
|
||||
impl Drop for HasDrop {
|
||||
fn drop(&mut self) {}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ mod utils;
|
|||
|
||||
#[repr(align(8))]
|
||||
#[derive(Copy, Clone)]
|
||||
struct Align8(u64);
|
||||
struct Align8(#[allow(dead_code)] u64);
|
||||
|
||||
fn main() {
|
||||
let buffer = [0u32; 128]; // get some 4-aligned memory
|
||||
|
|
@ -35,7 +35,7 @@ fn main() {
|
|||
if cfg!(read_unaligned_ptr) {
|
||||
#[repr(align(16))]
|
||||
#[derive(Copy, Clone)]
|
||||
struct Align16(u128);
|
||||
struct Align16(#[allow(dead_code)] u128);
|
||||
|
||||
let align16 = if align8.addr() % 16 == 0 { align8 } else { align8.wrapping_add(2) };
|
||||
assert!(align16.addr() % 16 == 0);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ fn test_align_to() {
|
|||
{
|
||||
#[repr(align(8))]
|
||||
#[derive(Copy, Clone)]
|
||||
struct Align8(u64);
|
||||
struct Align8(#[allow(dead_code)] u64);
|
||||
|
||||
let (_l, m, _r) = unsafe { s.align_to::<Align8>() };
|
||||
assert!(m.len() > 0);
|
||||
|
|
@ -97,7 +97,7 @@ fn huge_align() {
|
|||
const SIZE: usize = 1 << 30;
|
||||
#[cfg(target_pointer_width = "16")]
|
||||
const SIZE: usize = 1 << 13;
|
||||
struct HugeSize([u8; SIZE - 1]);
|
||||
struct HugeSize(#[allow(dead_code)] [u8; SIZE - 1]);
|
||||
let _ = std::ptr::invalid::<HugeSize>(SIZE).align_offset(SIZE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ fn test1() {
|
|||
}
|
||||
|
||||
// Make the allocator itself so big that the Box is not even a ScalarPair any more.
|
||||
struct OnceAllocRef<'s, 'a>(&'s OnceAlloc<'a>, u64);
|
||||
struct OnceAllocRef<'s, 'a>(&'s OnceAlloc<'a>, #[allow(dead_code)] u64);
|
||||
|
||||
unsafe impl<'shared, 'a: 'shared> Allocator for OnceAllocRef<'shared, 'a> {
|
||||
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ fn boxed_pair_to_vec() {
|
|||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Foo(u64);
|
||||
struct Foo(#[allow(dead_code)] u64);
|
||||
fn reinterstruct(box_pair: Box<PairFoo>) -> Vec<Foo> {
|
||||
let ref_pair = Box::leak(box_pair) as *mut PairFoo;
|
||||
let ptr_foo = unsafe { std::ptr::addr_of_mut!((*ref_pair).fst) };
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// test that ordinary fat pointer operations work.
|
||||
|
||||
struct Wrapper<T: ?Sized>(u32, T);
|
||||
struct Wrapper<T: ?Sized>(#[allow(dead_code)] u32, T);
|
||||
|
||||
struct FatPtrContainer<'a> {
|
||||
ptr: &'a [u8],
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
use std::mem;
|
||||
|
||||
#[repr(packed(4))]
|
||||
struct Slice([u32]);
|
||||
struct Slice(#[allow(dead_code)] [u32]);
|
||||
|
||||
#[repr(packed(2), C)]
|
||||
struct PackedSized {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#[repr(u8)]
|
||||
enum Foo {
|
||||
Foo(u8),
|
||||
Foo(#[allow(dead_code)] u8),
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
use std::mem;
|
||||
|
||||
const SZ: usize = 100;
|
||||
struct P<T: ?Sized>([u8; SZ], T);
|
||||
struct P<T: ?Sized>(#[allow(dead_code)] [u8; SZ], T);
|
||||
|
||||
type Ack<T> = P<P<T>>;
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ fn test_inner_packed() {
|
|||
struct Inner(u32);
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
struct Outer(u8, Inner);
|
||||
struct Outer(#[allow(dead_code)] u8, Inner);
|
||||
|
||||
let o = Outer(0, Inner(42));
|
||||
let _x = o.1;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//@compile-flags: -Zmiri-retag-fields=none
|
||||
|
||||
struct Newtype<'a>(&'a mut i32);
|
||||
struct Newtype<'a>(#[allow(dead_code)] &'a mut i32);
|
||||
|
||||
fn dealloc_while_running(_n: Newtype<'_>, dealloc: impl FnOnce()) {
|
||||
dealloc();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//@compile-flags: -Zmiri-retag-fields=scalar
|
||||
|
||||
struct Newtype<'a>(&'a mut i32, i32, i32);
|
||||
struct Newtype<'a>(#[allow(dead_code)] &'a mut i32, #[allow(dead_code)] i32, #[allow(dead_code)] i32);
|
||||
|
||||
fn dealloc_while_running(_n: Newtype<'_>, dealloc: impl FnOnce()) {
|
||||
dealloc();
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ fn not_unpin_not_protected() {
|
|||
// the self-referential-coroutine situation, it does not seem worth the potential trouble.)
|
||||
use std::marker::PhantomPinned;
|
||||
|
||||
pub struct NotUnpin(i32, PhantomPinned);
|
||||
pub struct NotUnpin(#[allow(dead_code)] i32, PhantomPinned);
|
||||
|
||||
fn inner(x: &mut NotUnpin, f: fn(&mut NotUnpin)) {
|
||||
// `f` may mutate, but it may not deallocate!
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ fn not_unpin_not_protected() {
|
|||
// the self-referential-coroutine situation, it does not seem worth the potential trouble.)
|
||||
use std::marker::PhantomPinned;
|
||||
|
||||
pub struct NotUnpin(i32, PhantomPinned);
|
||||
pub struct NotUnpin(#[allow(dead_code)] i32, PhantomPinned);
|
||||
|
||||
fn inner(x: &mut NotUnpin, f: fn(&mut NotUnpin)) {
|
||||
// `f` may mutate, but it may not deallocate!
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ impl Drop for Foo {
|
|||
static mut FOO: bool = false;
|
||||
|
||||
enum Bar {
|
||||
A(Box<i32>),
|
||||
A(#[allow(dead_code)] Box<i32>),
|
||||
B(Foo),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1947,7 +1947,7 @@ fn rewrite_unary_op(
|
|||
}
|
||||
|
||||
pub(crate) enum RhsAssignKind<'ast> {
|
||||
Expr(&'ast ast::ExprKind, Span),
|
||||
Expr(&'ast ast::ExprKind, #[allow(dead_code)] Span),
|
||||
Bounds,
|
||||
Ty,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue