Skip to content

Commit

Permalink
Rollup merge of rust-lang#121120 - nnethercote:LitKind-Err-guar, r=fm…
Browse files Browse the repository at this point in the history
…ease

Add `ErrorGuaranteed` to `ast::LitKind::Err`, `token::LitKind::Err`.

Similar to recent work doing the same for `ExprKind::Err` (rust-lang#120586) and `TyKind::Err` (rust-lang#121109).

r? `@oli-obk`
  • Loading branch information
GuillaumeGomez authored Feb 15, 2024
2 parents eff8793 + 33603a6 commit f9b8672
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion clippy_lints/src/matches/match_same_arms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ impl<'a> NormalizedPat<'a> {
LitKind::Char(val) => Self::LitInt(val.into()),
LitKind::Int(val, _) => Self::LitInt(val.get()),
LitKind::Bool(val) => Self::LitBool(val),
LitKind::Float(..) | LitKind::Err => Self::Wild,
LitKind::Float(..) => Self::Wild,
LitKind::Err(guar) => Self::Err(guar),
},
_ => Self::Wild,
},
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/redundant_type_annotations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ impl LateLintPass<'_> for RedundantTypeAnnotations {
span_lint(cx, REDUNDANT_TYPE_ANNOTATIONS, local.span, "redundant type annotation");
}
},
LitKind::Err => (),
LitKind::Err(_) => (),
LitKind::ByteStr(..) => {
// We only lint if the type annotation is an array type (e.g. &[u8; 4]).
// If instead it is a slice (e.g. &[u8]) it may not be redundant, so we
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/author.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
match lit.value.node {
LitKind::Bool(val) => kind!("Bool({val:?})"),
LitKind::Char(c) => kind!("Char({c:?})"),
LitKind::Err => kind!("Err"),
LitKind::Err(_) => kind!("Err"),
LitKind::Byte(b) => kind!("Byte({b})"),
LitKind::Int(i, suffix) => {
let int_ty = match suffix {
Expand Down
2 changes: 1 addition & 1 deletion clippy_utils/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ pub fn lit_to_mir_constant<'tcx>(lit: &LitKind, ty: Option<Ty<'tcx>>) -> Constan
_ => bug!(),
},
LitKind::Bool(b) => Constant::Bool(b),
LitKind::Err => Constant::Err,
LitKind::Err(_) => Constant::Err,
}
}

Expand Down

0 comments on commit f9b8672

Please sign in to comment.