Skip to content

Commit 7969056

Browse files
committed
Rename the ConstS::val field as kind.
And likewise for the `Const::val` method. Because its type is called `ConstKind`. Also `val` is a confusing name because `ConstKind` is an enum with seven variants, one of which is called `Value`. Also, this gives consistency with `TyS` and `PredicateS` which have `kind` fields. The commit also renames a few `Const` variables from `val` to `c`, to avoid confusion with the `ConstKind::Value` variant.
1 parent d024997 commit 7969056

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

clippy_lints/src/large_const_arrays.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<'tcx> LateLintPass<'tcx> for LargeConstArrays {
5353
if let ItemKind::Const(hir_ty, _) = &item.kind;
5454
let ty = hir_ty_to_ty(cx.tcx, hir_ty);
5555
if let ty::Array(element_type, cst) = ty.kind();
56-
if let ConstKind::Value(ConstValue::Scalar(element_count)) = cst.val();
56+
if let ConstKind::Value(ConstValue::Scalar(element_count)) = cst.kind();
5757
if let Ok(element_count) = element_count.to_machine_usize(&cx.tcx);
5858
if let Ok(element_size) = cx.layout_of(*element_type).map(|l| l.size.bytes());
5959
if self.maximum_allowed_size < element_count * element_size;

clippy_lints/src/large_stack_arrays.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl<'tcx> LateLintPass<'tcx> for LargeStackArrays {
4343
if_chain! {
4444
if let ExprKind::Repeat(_, _) = expr.kind;
4545
if let ty::Array(element_type, cst) = cx.typeck_results().expr_ty(expr).kind();
46-
if let ConstKind::Value(ConstValue::Scalar(element_count)) = cst.val();
46+
if let ConstKind::Value(ConstValue::Scalar(element_count)) = cst.kind();
4747
if let Ok(element_count) = element_count.to_machine_usize(&cx.tcx);
4848
if let Ok(element_size) = cx.layout_of(*element_type).map(|l| l.size.bytes());
4949
if self.maximum_allowed_size < element_count * element_size;

clippy_utils/src/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
582582

583583
pub fn miri_to_const(result: ty::Const<'_>) -> Option<Constant> {
584584
use rustc_middle::mir::interpret::ConstValue;
585-
match result.val() {
585+
match result.kind() {
586586
ty::ConstKind::Value(ConstValue::Scalar(Scalar::Int(int))) => {
587587
match result.ty().kind() {
588588
ty::Bool => Some(Constant::Bool(int == ScalarInt::TRUE)),

0 commit comments

Comments
 (0)