mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-01 03:03:40 +00:00
Rename std::mem::size_of_value to std::mem::size_of_val
This commit is contained in:
parent
90cb0fa2f3
commit
4fb38cfb29
@ -38,7 +38,7 @@ declare_lint_pass!(ManualSliceSizeCalculation => [MANUAL_SLICE_SIZE_CALCULATION]
|
|||||||
|
|
||||||
impl<'tcx> LateLintPass<'tcx> for ManualSliceSizeCalculation {
|
impl<'tcx> LateLintPass<'tcx> for ManualSliceSizeCalculation {
|
||||||
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
|
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
|
||||||
// Does not apply inside const because size_of_value is not cost in stable.
|
// Does not apply inside const because size_of_val is not cost in stable.
|
||||||
if !in_constant(cx, expr.hir_id)
|
if !in_constant(cx, expr.hir_id)
|
||||||
&& let ExprKind::Binary(ref op, left, right) = expr.kind
|
&& let ExprKind::Binary(ref op, left, right) = expr.kind
|
||||||
&& BinOpKind::Mul == op.node
|
&& BinOpKind::Mul == op.node
|
||||||
@ -50,7 +50,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualSliceSizeCalculation {
|
|||||||
expr.span,
|
expr.span,
|
||||||
"manual slice size calculation",
|
"manual slice size calculation",
|
||||||
None,
|
None,
|
||||||
"consider using std::mem::size_of_value instead");
|
"consider using std::mem::size_of_val instead");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ error: manual slice size calculation
|
|||||||
LL | let _ = s_i32.len() * size_of::<i32>(); // WARNING
|
LL | let _ = s_i32.len() * size_of::<i32>(); // WARNING
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: consider using std::mem::size_of_value instead
|
= help: consider using std::mem::size_of_val instead
|
||||||
= note: `-D clippy::manual-slice-size-calculation` implied by `-D warnings`
|
= note: `-D clippy::manual-slice-size-calculation` implied by `-D warnings`
|
||||||
|
|
||||||
error: manual slice size calculation
|
error: manual slice size calculation
|
||||||
@ -13,7 +13,7 @@ error: manual slice size calculation
|
|||||||
LL | let _ = size_of::<i32>() * s_i32.len(); // WARNING
|
LL | let _ = size_of::<i32>() * s_i32.len(); // WARNING
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: consider using std::mem::size_of_value instead
|
= help: consider using std::mem::size_of_val instead
|
||||||
|
|
||||||
error: manual slice size calculation
|
error: manual slice size calculation
|
||||||
--> $DIR/manual_slice_size_calculation.rs:13:13
|
--> $DIR/manual_slice_size_calculation.rs:13:13
|
||||||
@ -21,7 +21,7 @@ error: manual slice size calculation
|
|||||||
LL | let _ = size_of::<i32>() * s_i32.len() * 5; // WARNING
|
LL | let _ = size_of::<i32>() * s_i32.len() * 5; // WARNING
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: consider using std::mem::size_of_value instead
|
= help: consider using std::mem::size_of_val instead
|
||||||
|
|
||||||
error: manual slice size calculation
|
error: manual slice size calculation
|
||||||
--> $DIR/manual_slice_size_calculation.rs:17:13
|
--> $DIR/manual_slice_size_calculation.rs:17:13
|
||||||
@ -29,7 +29,7 @@ error: manual slice size calculation
|
|||||||
LL | let _ = len * size_of::<i32>(); // WARNING
|
LL | let _ = len * size_of::<i32>(); // WARNING
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: consider using std::mem::size_of_value instead
|
= help: consider using std::mem::size_of_val instead
|
||||||
|
|
||||||
error: manual slice size calculation
|
error: manual slice size calculation
|
||||||
--> $DIR/manual_slice_size_calculation.rs:18:13
|
--> $DIR/manual_slice_size_calculation.rs:18:13
|
||||||
@ -37,7 +37,7 @@ error: manual slice size calculation
|
|||||||
LL | let _ = s_i32.len() * size; // WARNING
|
LL | let _ = s_i32.len() * size; // WARNING
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: consider using std::mem::size_of_value instead
|
= help: consider using std::mem::size_of_val instead
|
||||||
|
|
||||||
error: manual slice size calculation
|
error: manual slice size calculation
|
||||||
--> $DIR/manual_slice_size_calculation.rs:19:13
|
--> $DIR/manual_slice_size_calculation.rs:19:13
|
||||||
@ -45,7 +45,7 @@ error: manual slice size calculation
|
|||||||
LL | let _ = len * size; // WARNING
|
LL | let _ = len * size; // WARNING
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= help: consider using std::mem::size_of_value instead
|
= help: consider using std::mem::size_of_val instead
|
||||||
|
|
||||||
error: aborting due to 6 previous errors
|
error: aborting due to 6 previous errors
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user