diff options
| author | Morten Lohne <lohnemorten@gmail.com> | 2023-08-06 13:29:50 +0200 |
|---|---|---|
| committer | Morten Lohne <lohnemorten@gmail.com> | 2023-08-06 13:29:50 +0200 |
| commit | 964644692324c41fae286208417086c45b5c878e (patch) | |
| tree | b309058ba1c57173192caab0c1799b5406248592 | |
| parent | 1d61fc1b0a02bb8f4a597279f03e897de0e521d1 (diff) | |
| download | rust-964644692324c41fae286208417086c45b5c878e.tar.gz rust-964644692324c41fae286208417086c45b5c878e.zip | |
Add lifetime parameter to 'Constant', after rebasing on upstream
| -rw-r--r-- | clippy_lints/src/operators/const_comparisons.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clippy_lints/src/operators/const_comparisons.rs b/clippy_lints/src/operators/const_comparisons.rs index 357981c10ad..16ac964e93a 100644 --- a/clippy_lints/src/operators/const_comparisons.rs +++ b/clippy_lints/src/operators/const_comparisons.rs @@ -7,15 +7,15 @@ use clippy_utils::consts::{ConstEvalLateContext, Constant}; use if_chain::if_chain; use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::LateContext; -use rustc_middle::ty::{layout::HasTyCtxt, Ty, TypeckResults}; +use rustc_middle::ty::layout::HasTyCtxt; +use rustc_middle::ty::{Ty, TypeckResults}; use rustc_span::source_map::{Span, Spanned}; use clippy_utils::diagnostics::span_lint_and_note; use clippy_utils::source::snippet; use clippy_utils::SpanlessEq; -use super::IMPOSSIBLE_COMPARISONS; -use super::REDUNDANT_COMPARISONS; +use super::{IMPOSSIBLE_COMPARISONS, REDUNDANT_COMPARISONS}; // Extract a comparison between a const and non-const // Flip yoda conditionals, turnings expressions like `42 < x` into `x > 42` @@ -23,7 +23,7 @@ fn comparison_to_const<'tcx>( ctx: &mut ConstEvalLateContext<'_, 'tcx>, typeck: &TypeckResults<'tcx>, expr: &'tcx Expr<'tcx>, -) -> Option<(CmpOp, &'tcx Expr<'tcx>, &'tcx Expr<'tcx>, Constant, Ty<'tcx>)> { +) -> Option<(CmpOp, &'tcx Expr<'tcx>, &'tcx Expr<'tcx>, Constant<'tcx>, Ty<'tcx>)> { if_chain! { if let ExprKind::Binary(operator, left, right) = expr.kind; if let Ok(cmp_op) = CmpOp::try_from(operator.node); |
