diff options
| author | xFrednet <xFrednet@gmail.com> | 2022-01-15 00:39:06 +0100 |
|---|---|---|
| committer | xFrednet <xFrednet@gmail.com> | 2022-01-15 00:57:43 +0100 |
| commit | 1afeb7106514557e19b2eb48529a9a96879ca4d3 (patch) | |
| tree | 9c668e7a2f37fc2a6ddef400e97e0dba1f18be7d /tests | |
| parent | 9e7858545a2c0427120065431809653e3bb78ce2 (diff) | |
| download | rust-1afeb7106514557e19b2eb48529a9a96879ca4d3.tar.gz rust-1afeb7106514557e19b2eb48529a9a96879ca4d3.zip | |
Track `msrv` attribute for `manual_bits` and `borrow_as_prt`
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui-toml/min_rust_version/min_rust_version.rs | 19 | ||||
| -rw-r--r-- | tests/ui-toml/min_rust_version/min_rust_version.stderr | 2 |
2 files changed, 18 insertions, 3 deletions
diff --git a/tests/ui-toml/min_rust_version/min_rust_version.rs b/tests/ui-toml/min_rust_version/min_rust_version.rs index 213252f7b58..1e3ec123a3c 100644 --- a/tests/ui-toml/min_rust_version/min_rust_version.rs +++ b/tests/ui-toml/min_rust_version/min_rust_version.rs @@ -1,6 +1,7 @@ -#![allow(clippy::redundant_clone)] -#![warn(clippy::manual_non_exhaustive)] +#![allow(clippy::redundant_clone, clippy::unnecessary_operation)] +#![warn(clippy::manual_non_exhaustive, clippy::borrow_as_ptr, clippy::manual_bits)] +use std::mem::{size_of, size_of_val}; use std::ops::Deref; mod enums { @@ -73,6 +74,19 @@ fn map_clone_suggest_copied() { let _: Option<u64> = Some(&16).map(|b| *b); } +fn borrow_as_ptr() { + let val = 1; + let _p = &val as *const i32; + + let mut val_mut = 1; + let _p_mut = &mut val_mut as *mut i32; +} + +fn manual_bits() { + size_of::<i8>() * 8; + size_of_val(&0u32) * 8; +} + fn main() { option_as_ref_deref(); match_like_matches(); @@ -80,4 +94,5 @@ fn main() { match_same_arms2(); manual_strip_msrv(); check_index_refutable_slice(); + borrow_as_ptr(); } diff --git a/tests/ui-toml/min_rust_version/min_rust_version.stderr b/tests/ui-toml/min_rust_version/min_rust_version.stderr index f226c012ca8..a1e7361c0cb 100644 --- a/tests/ui-toml/min_rust_version/min_rust_version.stderr +++ b/tests/ui-toml/min_rust_version/min_rust_version.stderr @@ -1,5 +1,5 @@ error: you are using an explicit closure for copying elements - --> $DIR/min_rust_version.rs:73:26 + --> $DIR/min_rust_version.rs:74:26 | LL | let _: Option<u64> = Some(&16).map(|b| *b); | ^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `Some(&16).cloned()` |
