Update tests for hidden references to mutable static
This commit is contained in:
parent
1c2e9f8775
commit
cd99729478
@ -236,5 +236,16 @@ LL | if result.is_ok() {
|
|||||||
LL | result.as_mut().unwrap();
|
LL | result.as_mut().unwrap();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 25 previous errors
|
error: creating a shared reference to mutable static is discouraged
|
||||||
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:174:12
|
||||||
|
|
|
||||||
|
LL | if X.is_some() {
|
||||||
|
| ^^^^^^^^^^^ shared reference to mutable static
|
||||||
|
|
|
||||||
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
|
||||||
|
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
|
||||||
|
= note: `-D static-mut-refs` implied by `-D warnings`
|
||||||
|
= help: to override `-D warnings` add `#[allow(static_mut_refs)]`
|
||||||
|
|
||||||
|
error: aborting due to 26 previous errors
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#![allow(deref_nullptr)]
|
#![allow(deref_nullptr)]
|
||||||
#![allow(clippy::unnecessary_operation)]
|
#![allow(clippy::unnecessary_operation)]
|
||||||
#![allow(dropping_copy_types)]
|
#![allow(dropping_copy_types)]
|
||||||
|
#![allow(clippy::assign_op_pattern)]
|
||||||
#![warn(clippy::multiple_unsafe_ops_per_block)]
|
#![warn(clippy::multiple_unsafe_ops_per_block)]
|
||||||
|
|
||||||
extern crate proc_macros;
|
extern crate proc_macros;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:37:5
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:38:5
|
||||||
|
|
|
|
||||||
LL | / unsafe {
|
LL | / unsafe {
|
||||||
LL | | STATIC += 1;
|
LL | | STATIC += 1;
|
||||||
@ -8,12 +8,12 @@ LL | | }
|
|||||||
| |_____^
|
| |_____^
|
||||||
|
|
|
|
||||||
note: modification of a mutable static occurs here
|
note: modification of a mutable static occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:38:9
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:39:9
|
||||||
|
|
|
|
||||||
LL | STATIC += 1;
|
LL | STATIC += 1;
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
note: unsafe function call occurs here
|
note: unsafe function call occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:39:9
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:40:9
|
||||||
|
|
|
|
||||||
LL | not_very_safe();
|
LL | not_very_safe();
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
@ -21,7 +21,7 @@ LL | not_very_safe();
|
|||||||
= help: to override `-D warnings` add `#[allow(clippy::multiple_unsafe_ops_per_block)]`
|
= help: to override `-D warnings` add `#[allow(clippy::multiple_unsafe_ops_per_block)]`
|
||||||
|
|
||||||
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:46:5
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:47:5
|
||||||
|
|
|
|
||||||
LL | / unsafe {
|
LL | / unsafe {
|
||||||
LL | | drop(u.u);
|
LL | | drop(u.u);
|
||||||
@ -30,18 +30,18 @@ LL | | }
|
|||||||
| |_____^
|
| |_____^
|
||||||
|
|
|
|
||||||
note: union field access occurs here
|
note: union field access occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:47:14
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:48:14
|
||||||
|
|
|
|
||||||
LL | drop(u.u);
|
LL | drop(u.u);
|
||||||
| ^^^
|
| ^^^
|
||||||
note: raw pointer dereference occurs here
|
note: raw pointer dereference occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:48:9
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:49:9
|
||||||
|
|
|
|
||||||
LL | *raw_ptr();
|
LL | *raw_ptr();
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error: this `unsafe` block contains 3 unsafe operations, expected only one
|
error: this `unsafe` block contains 3 unsafe operations, expected only one
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:53:5
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:54:5
|
||||||
|
|
|
|
||||||
LL | / unsafe {
|
LL | / unsafe {
|
||||||
LL | | asm!("nop");
|
LL | | asm!("nop");
|
||||||
@ -51,23 +51,23 @@ LL | | }
|
|||||||
| |_____^
|
| |_____^
|
||||||
|
|
|
|
||||||
note: inline assembly used here
|
note: inline assembly used here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:54:9
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:55:9
|
||||||
|
|
|
|
||||||
LL | asm!("nop");
|
LL | asm!("nop");
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
note: unsafe method call occurs here
|
note: unsafe method call occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:55:9
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:56:9
|
||||||
|
|
|
|
||||||
LL | sample.not_very_safe();
|
LL | sample.not_very_safe();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
note: modification of a mutable static occurs here
|
note: modification of a mutable static occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:56:9
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:57:9
|
||||||
|
|
|
|
||||||
LL | STATIC = 0;
|
LL | STATIC = 0;
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error: this `unsafe` block contains 6 unsafe operations, expected only one
|
error: this `unsafe` block contains 6 unsafe operations, expected only one
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:62:5
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:63:5
|
||||||
|
|
|
|
||||||
LL | / unsafe {
|
LL | / unsafe {
|
||||||
LL | | drop(u.u);
|
LL | | drop(u.u);
|
||||||
@ -79,55 +79,55 @@ LL | | }
|
|||||||
| |_____^
|
| |_____^
|
||||||
|
|
|
|
||||||
note: union field access occurs here
|
note: union field access occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:63:14
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:64:14
|
||||||
|
|
|
|
||||||
LL | drop(u.u);
|
LL | drop(u.u);
|
||||||
| ^^^
|
| ^^^
|
||||||
note: access of a mutable static occurs here
|
note: access of a mutable static occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:64:14
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:65:14
|
||||||
|
|
|
|
||||||
LL | drop(STATIC);
|
LL | drop(STATIC);
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
note: unsafe method call occurs here
|
note: unsafe method call occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:65:9
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:66:9
|
||||||
|
|
|
|
||||||
LL | sample.not_very_safe();
|
LL | sample.not_very_safe();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
note: unsafe function call occurs here
|
note: unsafe function call occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:66:9
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:67:9
|
||||||
|
|
|
|
||||||
LL | not_very_safe();
|
LL | not_very_safe();
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
note: raw pointer dereference occurs here
|
note: raw pointer dereference occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:67:9
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:68:9
|
||||||
|
|
|
|
||||||
LL | *raw_ptr();
|
LL | *raw_ptr();
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
note: inline assembly used here
|
note: inline assembly used here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:68:9
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:69:9
|
||||||
|
|
|
|
||||||
LL | asm!("nop");
|
LL | asm!("nop");
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:106:5
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:107:5
|
||||||
|
|
|
|
||||||
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
|
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: unsafe function call occurs here
|
note: unsafe function call occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:106:14
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:107:14
|
||||||
|
|
|
|
||||||
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
|
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
note: raw pointer dereference occurs here
|
note: raw pointer dereference occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:106:39
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:107:39
|
||||||
|
|
|
|
||||||
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
|
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:124:5
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:125:5
|
||||||
|
|
|
|
||||||
LL | / unsafe {
|
LL | / unsafe {
|
||||||
LL | | x();
|
LL | | x();
|
||||||
@ -136,18 +136,18 @@ LL | | }
|
|||||||
| |_____^
|
| |_____^
|
||||||
|
|
|
|
||||||
note: unsafe function call occurs here
|
note: unsafe function call occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:125:9
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:126:9
|
||||||
|
|
|
|
||||||
LL | x();
|
LL | x();
|
||||||
| ^^^
|
| ^^^
|
||||||
note: unsafe function call occurs here
|
note: unsafe function call occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:126:9
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:127:9
|
||||||
|
|
|
|
||||||
LL | x();
|
LL | x();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
||||||
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:135:9
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:136:9
|
||||||
|
|
|
|
||||||
LL | / unsafe {
|
LL | / unsafe {
|
||||||
LL | | T::X();
|
LL | | T::X();
|
||||||
@ -156,18 +156,18 @@ LL | | }
|
|||||||
| |_________^
|
| |_________^
|
||||||
|
|
|
|
||||||
note: unsafe function call occurs here
|
note: unsafe function call occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:136:13
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:137:13
|
||||||
|
|
|
|
||||||
LL | T::X();
|
LL | T::X();
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
note: unsafe function call occurs here
|
note: unsafe function call occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:137:13
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:138:13
|
||||||
|
|
|
|
||||||
LL | T::X();
|
LL | T::X();
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
||||||
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:145:5
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:146:5
|
||||||
|
|
|
|
||||||
LL | / unsafe {
|
LL | / unsafe {
|
||||||
LL | | x.0();
|
LL | | x.0();
|
||||||
@ -176,12 +176,12 @@ LL | | }
|
|||||||
| |_____^
|
| |_____^
|
||||||
|
|
|
|
||||||
note: unsafe function call occurs here
|
note: unsafe function call occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:146:9
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:147:9
|
||||||
|
|
|
|
||||||
LL | x.0();
|
LL | x.0();
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
note: unsafe function call occurs here
|
note: unsafe function call occurs here
|
||||||
--> tests/ui/multiple_unsafe_ops_per_block.rs:147:9
|
--> tests/ui/multiple_unsafe_ops_per_block.rs:148:9
|
||||||
|
|
|
|
||||||
LL | x.0();
|
LL | x.0();
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
#![allow(unused_mut, clippy::redundant_allocation, clippy::needless_pass_by_ref_mut)]
|
#![allow(
|
||||||
|
unused_mut,
|
||||||
|
clippy::redundant_allocation,
|
||||||
|
clippy::needless_pass_by_ref_mut,
|
||||||
|
static_mut_refs
|
||||||
|
)]
|
||||||
#![warn(clippy::must_use_candidate)]
|
#![warn(clippy::must_use_candidate)]
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
#![allow(unused_mut, clippy::redundant_allocation, clippy::needless_pass_by_ref_mut)]
|
#![allow(
|
||||||
|
unused_mut,
|
||||||
|
clippy::redundant_allocation,
|
||||||
|
clippy::needless_pass_by_ref_mut,
|
||||||
|
static_mut_refs
|
||||||
|
)]
|
||||||
#![warn(clippy::must_use_candidate)]
|
#![warn(clippy::must_use_candidate)]
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error: this function could have a `#[must_use]` attribute
|
error: this function could have a `#[must_use]` attribute
|
||||||
--> tests/ui/must_use_candidates.rs:11:1
|
--> tests/ui/must_use_candidates.rs:16:1
|
||||||
|
|
|
|
||||||
LL | pub fn pure(i: u8) -> u8 {
|
LL | pub fn pure(i: u8) -> u8 {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn pure(i: u8) -> u8`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn pure(i: u8) -> u8`
|
||||||
@ -8,25 +8,25 @@ LL | pub fn pure(i: u8) -> u8 {
|
|||||||
= help: to override `-D warnings` add `#[allow(clippy::must_use_candidate)]`
|
= help: to override `-D warnings` add `#[allow(clippy::must_use_candidate)]`
|
||||||
|
|
||||||
error: this method could have a `#[must_use]` attribute
|
error: this method could have a `#[must_use]` attribute
|
||||||
--> tests/ui/must_use_candidates.rs:16:5
|
--> tests/ui/must_use_candidates.rs:21:5
|
||||||
|
|
|
|
||||||
LL | pub fn inherent_pure(&self) -> u8 {
|
LL | pub fn inherent_pure(&self) -> u8 {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn inherent_pure(&self) -> u8`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn inherent_pure(&self) -> u8`
|
||||||
|
|
||||||
error: this function could have a `#[must_use]` attribute
|
error: this function could have a `#[must_use]` attribute
|
||||||
--> tests/ui/must_use_candidates.rs:47:1
|
--> tests/ui/must_use_candidates.rs:52:1
|
||||||
|
|
|
|
||||||
LL | pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool {
|
LL | pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool`
|
||||||
|
|
||||||
error: this function could have a `#[must_use]` attribute
|
error: this function could have a `#[must_use]` attribute
|
||||||
--> tests/ui/must_use_candidates.rs:59:1
|
--> tests/ui/must_use_candidates.rs:64:1
|
||||||
|
|
|
|
||||||
LL | pub fn rcd(_x: Rc<u32>) -> bool {
|
LL | pub fn rcd(_x: Rc<u32>) -> bool {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn rcd(_x: Rc<u32>) -> bool`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn rcd(_x: Rc<u32>) -> bool`
|
||||||
|
|
||||||
error: this function could have a `#[must_use]` attribute
|
error: this function could have a `#[must_use]` attribute
|
||||||
--> tests/ui/must_use_candidates.rs:67:1
|
--> tests/ui/must_use_candidates.rs:72:1
|
||||||
|
|
|
|
||||||
LL | pub fn arcd(_x: Arc<u32>) -> bool {
|
LL | pub fn arcd(_x: Arc<u32>) -> bool {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn arcd(_x: Arc<u32>) -> bool`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn arcd(_x: Arc<u32>) -> bool`
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#![allow(unused)]
|
#![allow(unused)]
|
||||||
|
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
|
||||||
|
#![allow(static_mut_refs)]
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct Foo;
|
struct Foo;
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#![allow(unused)]
|
#![allow(unused)]
|
||||||
|
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
|
||||||
|
#![allow(static_mut_refs)]
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct Foo;
|
struct Foo;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error: constants have by default a `'static` lifetime
|
error: constants have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:6:17
|
--> tests/ui/redundant_static_lifetimes.rs:8:17
|
||||||
|
|
|
|
||||||
LL | const VAR_ONE: &'static str = "Test constant #1"; // ERROR: Consider removing 'static.
|
LL | const VAR_ONE: &'static str = "Test constant #1"; // ERROR: Consider removing 'static.
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
@ -8,103 +8,103 @@ LL | const VAR_ONE: &'static str = "Test constant #1"; // ERROR: Consider removi
|
|||||||
= help: to override `-D warnings` add `#[allow(clippy::redundant_static_lifetimes)]`
|
= help: to override `-D warnings` add `#[allow(clippy::redundant_static_lifetimes)]`
|
||||||
|
|
||||||
error: constants have by default a `'static` lifetime
|
error: constants have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:10:21
|
--> tests/ui/redundant_static_lifetimes.rs:12:21
|
||||||
|
|
|
|
||||||
LL | const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR: Consider removing 'static
|
LL | const VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR: Consider removing 'static
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
||||||
error: constants have by default a `'static` lifetime
|
error: constants have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:12:32
|
--> tests/ui/redundant_static_lifetimes.rs:14:32
|
||||||
|
|
|
|
||||||
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static
|
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
||||||
error: constants have by default a `'static` lifetime
|
error: constants have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:12:47
|
--> tests/ui/redundant_static_lifetimes.rs:14:47
|
||||||
|
|
|
|
||||||
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static
|
LL | const VAR_FOUR: (&str, (&str, &'static str), &'static str) = ("on", ("th", "th"), "on"); // ERROR: Consider removing 'static
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
||||||
error: constants have by default a `'static` lifetime
|
error: constants have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:14:17
|
--> tests/ui/redundant_static_lifetimes.rs:16:17
|
||||||
|
|
|
|
||||||
LL | const VAR_SIX: &'static u8 = &5;
|
LL | const VAR_SIX: &'static u8 = &5;
|
||||||
| -^^^^^^^--- help: consider removing `'static`: `&u8`
|
| -^^^^^^^--- help: consider removing `'static`: `&u8`
|
||||||
|
|
||||||
error: constants have by default a `'static` lifetime
|
error: constants have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:16:20
|
--> tests/ui/redundant_static_lifetimes.rs:18:20
|
||||||
|
|
|
|
||||||
LL | const VAR_HEIGHT: &'static Foo = &Foo {};
|
LL | const VAR_HEIGHT: &'static Foo = &Foo {};
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
|
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
|
||||||
|
|
||||||
error: constants have by default a `'static` lifetime
|
error: constants have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:18:19
|
--> tests/ui/redundant_static_lifetimes.rs:20:19
|
||||||
|
|
|
|
||||||
LL | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR: Consider removing 'static.
|
LL | const VAR_SLICE: &'static [u8] = b"Test constant #1"; // ERROR: Consider removing 'static.
|
||||||
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
|
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
|
||||||
|
|
||||||
error: constants have by default a `'static` lifetime
|
error: constants have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:20:19
|
--> tests/ui/redundant_static_lifetimes.rs:22:19
|
||||||
|
|
|
|
||||||
LL | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR: Consider removing 'static.
|
LL | const VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR: Consider removing 'static.
|
||||||
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
|
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
|
||||||
|
|
||||||
error: constants have by default a `'static` lifetime
|
error: constants have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:22:19
|
--> tests/ui/redundant_static_lifetimes.rs:24:19
|
||||||
|
|
|
|
||||||
LL | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR: Consider removing 'static.
|
LL | const VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR: Consider removing 'static.
|
||||||
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
|
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
|
||||||
|
|
||||||
error: statics have by default a `'static` lifetime
|
error: statics have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:24:25
|
--> tests/ui/redundant_static_lifetimes.rs:26:25
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_ONE: &'static str = "Test static #1"; // ERROR: Consider removing 'static.
|
LL | static STATIC_VAR_ONE: &'static str = "Test static #1"; // ERROR: Consider removing 'static.
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
||||||
error: statics have by default a `'static` lifetime
|
error: statics have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:28:29
|
--> tests/ui/redundant_static_lifetimes.rs:30:29
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR: Consider removing 'static
|
LL | static STATIC_VAR_THREE: &[&'static str] = &["one", "two"]; // ERROR: Consider removing 'static
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
| -^^^^^^^---- help: consider removing `'static`: `&str`
|
||||||
|
|
||||||
error: statics have by default a `'static` lifetime
|
error: statics have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:30:25
|
--> tests/ui/redundant_static_lifetimes.rs:32:25
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_SIX: &'static u8 = &5;
|
LL | static STATIC_VAR_SIX: &'static u8 = &5;
|
||||||
| -^^^^^^^--- help: consider removing `'static`: `&u8`
|
| -^^^^^^^--- help: consider removing `'static`: `&u8`
|
||||||
|
|
||||||
error: statics have by default a `'static` lifetime
|
error: statics have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:32:28
|
--> tests/ui/redundant_static_lifetimes.rs:34:28
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_HEIGHT: &'static Foo = &Foo {};
|
LL | static STATIC_VAR_HEIGHT: &'static Foo = &Foo {};
|
||||||
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
|
| -^^^^^^^---- help: consider removing `'static`: `&Foo`
|
||||||
|
|
||||||
error: statics have by default a `'static` lifetime
|
error: statics have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:34:27
|
--> tests/ui/redundant_static_lifetimes.rs:36:27
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_SLICE: &'static [u8] = b"Test static #3"; // ERROR: Consider removing 'static.
|
LL | static STATIC_VAR_SLICE: &'static [u8] = b"Test static #3"; // ERROR: Consider removing 'static.
|
||||||
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
|
| -^^^^^^^----- help: consider removing `'static`: `&[u8]`
|
||||||
|
|
||||||
error: statics have by default a `'static` lifetime
|
error: statics have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:36:27
|
--> tests/ui/redundant_static_lifetimes.rs:38:27
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR: Consider removing 'static.
|
LL | static STATIC_VAR_TUPLE: &'static (u8, u8) = &(1, 2); // ERROR: Consider removing 'static.
|
||||||
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
|
| -^^^^^^^--------- help: consider removing `'static`: `&(u8, u8)`
|
||||||
|
|
||||||
error: statics have by default a `'static` lifetime
|
error: statics have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:38:27
|
--> tests/ui/redundant_static_lifetimes.rs:40:27
|
||||||
|
|
|
|
||||||
LL | static STATIC_VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR: Consider removing 'static.
|
LL | static STATIC_VAR_ARRAY: &'static [u8; 1] = b"T"; // ERROR: Consider removing 'static.
|
||||||
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
|
| -^^^^^^^-------- help: consider removing `'static`: `&[u8; 1]`
|
||||||
|
|
||||||
error: statics have by default a `'static` lifetime
|
error: statics have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:40:31
|
--> tests/ui/redundant_static_lifetimes.rs:42:31
|
||||||
|
|
|
|
||||||
LL | static mut STATIC_MUT_SLICE: &'static mut [u32] = &mut [0];
|
LL | static mut STATIC_MUT_SLICE: &'static mut [u32] = &mut [0];
|
||||||
| -^^^^^^^---------- help: consider removing `'static`: `&mut [u32]`
|
| -^^^^^^^---------- help: consider removing `'static`: `&mut [u32]`
|
||||||
|
|
||||||
error: statics have by default a `'static` lifetime
|
error: statics have by default a `'static` lifetime
|
||||||
--> tests/ui/redundant_static_lifetimes.rs:69:16
|
--> tests/ui/redundant_static_lifetimes.rs:71:16
|
||||||
|
|
|
|
||||||
LL | static V: &'static u8 = &17;
|
LL | static V: &'static u8 = &17;
|
||||||
| -^^^^^^^--- help: consider removing `'static`: `&u8`
|
| -^^^^^^^--- help: consider removing `'static`: `&u8`
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#![deny(clippy::useless_conversion)]
|
#![deny(clippy::useless_conversion)]
|
||||||
#![allow(clippy::needless_if, clippy::unnecessary_wraps)]
|
#![allow(clippy::needless_if, clippy::unnecessary_wraps)]
|
||||||
|
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
|
||||||
|
#![allow(static_mut_refs)]
|
||||||
|
|
||||||
fn test_generic<T: Copy>(val: T) -> T {
|
fn test_generic<T: Copy>(val: T) -> T {
|
||||||
let _ = val;
|
let _ = val;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#![deny(clippy::useless_conversion)]
|
#![deny(clippy::useless_conversion)]
|
||||||
#![allow(clippy::needless_if, clippy::unnecessary_wraps)]
|
#![allow(clippy::needless_if, clippy::unnecessary_wraps)]
|
||||||
|
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
|
||||||
|
#![allow(static_mut_refs)]
|
||||||
|
|
||||||
fn test_generic<T: Copy>(val: T) -> T {
|
fn test_generic<T: Copy>(val: T) -> T {
|
||||||
let _ = T::from(val);
|
let _ = T::from(val);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error: useless conversion to the same type: `T`
|
error: useless conversion to the same type: `T`
|
||||||
--> tests/ui/useless_conversion.rs:5:13
|
--> tests/ui/useless_conversion.rs:7:13
|
||||||
|
|
|
|
||||||
LL | let _ = T::from(val);
|
LL | let _ = T::from(val);
|
||||||
| ^^^^^^^^^^^^ help: consider removing `T::from()`: `val`
|
| ^^^^^^^^^^^^ help: consider removing `T::from()`: `val`
|
||||||
@ -11,217 +11,217 @@ LL | #![deny(clippy::useless_conversion)]
|
|||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: useless conversion to the same type: `T`
|
error: useless conversion to the same type: `T`
|
||||||
--> tests/ui/useless_conversion.rs:6:5
|
--> tests/ui/useless_conversion.rs:8:5
|
||||||
|
|
|
|
||||||
LL | val.into()
|
LL | val.into()
|
||||||
| ^^^^^^^^^^ help: consider removing `.into()`: `val`
|
| ^^^^^^^^^^ help: consider removing `.into()`: `val`
|
||||||
|
|
||||||
error: useless conversion to the same type: `i32`
|
error: useless conversion to the same type: `i32`
|
||||||
--> tests/ui/useless_conversion.rs:18:22
|
--> tests/ui/useless_conversion.rs:20:22
|
||||||
|
|
|
|
||||||
LL | let _: i32 = 0i32.into();
|
LL | let _: i32 = 0i32.into();
|
||||||
| ^^^^^^^^^^^ help: consider removing `.into()`: `0i32`
|
| ^^^^^^^^^^^ help: consider removing `.into()`: `0i32`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::str::Lines<'_>`
|
error: useless conversion to the same type: `std::str::Lines<'_>`
|
||||||
--> tests/ui/useless_conversion.rs:48:22
|
--> tests/ui/useless_conversion.rs:50:22
|
||||||
|
|
|
|
||||||
LL | if Some("ok") == lines.into_iter().next() {}
|
LL | if Some("ok") == lines.into_iter().next() {}
|
||||||
| ^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `lines`
|
| ^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `lines`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::str::Lines<'_>`
|
error: useless conversion to the same type: `std::str::Lines<'_>`
|
||||||
--> tests/ui/useless_conversion.rs:53:21
|
--> tests/ui/useless_conversion.rs:55:21
|
||||||
|
|
|
|
||||||
LL | let mut lines = text.lines().into_iter();
|
LL | let mut lines = text.lines().into_iter();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `text.lines()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `text.lines()`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::str::Lines<'_>`
|
error: useless conversion to the same type: `std::str::Lines<'_>`
|
||||||
--> tests/ui/useless_conversion.rs:59:22
|
--> tests/ui/useless_conversion.rs:61:22
|
||||||
|
|
|
|
||||||
LL | if Some("ok") == text.lines().into_iter().next() {}
|
LL | if Some("ok") == text.lines().into_iter().next() {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `text.lines()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `text.lines()`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::ops::Range<i32>`
|
error: useless conversion to the same type: `std::ops::Range<i32>`
|
||||||
--> tests/ui/useless_conversion.rs:65:13
|
--> tests/ui/useless_conversion.rs:67:13
|
||||||
|
|
|
|
||||||
LL | let _ = NUMBERS.into_iter().next();
|
LL | let _ = NUMBERS.into_iter().next();
|
||||||
| ^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `NUMBERS`
|
| ^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `NUMBERS`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::ops::Range<i32>`
|
error: useless conversion to the same type: `std::ops::Range<i32>`
|
||||||
--> tests/ui/useless_conversion.rs:70:17
|
--> tests/ui/useless_conversion.rs:72:17
|
||||||
|
|
|
|
||||||
LL | let mut n = NUMBERS.into_iter();
|
LL | let mut n = NUMBERS.into_iter();
|
||||||
| ^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `NUMBERS`
|
| ^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `NUMBERS`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::string::String`
|
error: useless conversion to the same type: `std::string::String`
|
||||||
--> tests/ui/useless_conversion.rs:132:21
|
--> tests/ui/useless_conversion.rs:134:21
|
||||||
|
|
|
|
||||||
LL | let _: String = "foo".to_string().into();
|
LL | let _: String = "foo".to_string().into();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `"foo".to_string()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `"foo".to_string()`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::string::String`
|
error: useless conversion to the same type: `std::string::String`
|
||||||
--> tests/ui/useless_conversion.rs:133:21
|
--> tests/ui/useless_conversion.rs:135:21
|
||||||
|
|
|
|
||||||
LL | let _: String = From::from("foo".to_string());
|
LL | let _: String = From::from("foo".to_string());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `From::from()`: `"foo".to_string()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `From::from()`: `"foo".to_string()`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::string::String`
|
error: useless conversion to the same type: `std::string::String`
|
||||||
--> tests/ui/useless_conversion.rs:134:13
|
--> tests/ui/useless_conversion.rs:136:13
|
||||||
|
|
|
|
||||||
LL | let _ = String::from("foo".to_string());
|
LL | let _ = String::from("foo".to_string());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `"foo".to_string()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `"foo".to_string()`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::string::String`
|
error: useless conversion to the same type: `std::string::String`
|
||||||
--> tests/ui/useless_conversion.rs:135:13
|
--> tests/ui/useless_conversion.rs:137:13
|
||||||
|
|
|
|
||||||
LL | let _ = String::from(format!("A: {:04}", 123));
|
LL | let _ = String::from(format!("A: {:04}", 123));
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `format!("A: {:04}", 123)`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `format!("A: {:04}", 123)`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::str::Lines<'_>`
|
error: useless conversion to the same type: `std::str::Lines<'_>`
|
||||||
--> tests/ui/useless_conversion.rs:136:13
|
--> tests/ui/useless_conversion.rs:138:13
|
||||||
|
|
|
|
||||||
LL | let _ = "".lines().into_iter();
|
LL | let _ = "".lines().into_iter();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `"".lines()`
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `"".lines()`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::vec::IntoIter<i32>`
|
error: useless conversion to the same type: `std::vec::IntoIter<i32>`
|
||||||
--> tests/ui/useless_conversion.rs:137:13
|
--> tests/ui/useless_conversion.rs:139:13
|
||||||
|
|
|
|
||||||
LL | let _ = vec![1, 2, 3].into_iter().into_iter();
|
LL | let _ = vec![1, 2, 3].into_iter().into_iter();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![1, 2, 3].into_iter()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![1, 2, 3].into_iter()`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::string::String`
|
error: useless conversion to the same type: `std::string::String`
|
||||||
--> tests/ui/useless_conversion.rs:138:21
|
--> tests/ui/useless_conversion.rs:140:21
|
||||||
|
|
|
|
||||||
LL | let _: String = format!("Hello {}", "world").into();
|
LL | let _: String = format!("Hello {}", "world").into();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `format!("Hello {}", "world")`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `format!("Hello {}", "world")`
|
||||||
|
|
||||||
error: useless conversion to the same type: `i32`
|
error: useless conversion to the same type: `i32`
|
||||||
--> tests/ui/useless_conversion.rs:143:13
|
--> tests/ui/useless_conversion.rs:145:13
|
||||||
|
|
|
|
||||||
LL | let _ = i32::from(a + b) * 3;
|
LL | let _ = i32::from(a + b) * 3;
|
||||||
| ^^^^^^^^^^^^^^^^ help: consider removing `i32::from()`: `(a + b)`
|
| ^^^^^^^^^^^^^^^^ help: consider removing `i32::from()`: `(a + b)`
|
||||||
|
|
||||||
error: useless conversion to the same type: `Foo<'a'>`
|
error: useless conversion to the same type: `Foo<'a'>`
|
||||||
--> tests/ui/useless_conversion.rs:149:23
|
--> tests/ui/useless_conversion.rs:151:23
|
||||||
|
|
|
|
||||||
LL | let _: Foo<'a'> = s2.into();
|
LL | let _: Foo<'a'> = s2.into();
|
||||||
| ^^^^^^^^^ help: consider removing `.into()`: `s2`
|
| ^^^^^^^^^ help: consider removing `.into()`: `s2`
|
||||||
|
|
||||||
error: useless conversion to the same type: `Foo<'a'>`
|
error: useless conversion to the same type: `Foo<'a'>`
|
||||||
--> tests/ui/useless_conversion.rs:151:13
|
--> tests/ui/useless_conversion.rs:153:13
|
||||||
|
|
|
|
||||||
LL | let _ = Foo::<'a'>::from(s3);
|
LL | let _ = Foo::<'a'>::from(s3);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^ help: consider removing `Foo::<'a'>::from()`: `s3`
|
| ^^^^^^^^^^^^^^^^^^^^ help: consider removing `Foo::<'a'>::from()`: `s3`
|
||||||
|
|
||||||
error: useless conversion to the same type: `std::vec::IntoIter<Foo<'a'>>`
|
error: useless conversion to the same type: `std::vec::IntoIter<Foo<'a'>>`
|
||||||
--> tests/ui/useless_conversion.rs:153:13
|
--> tests/ui/useless_conversion.rs:155:13
|
||||||
|
|
|
|
||||||
LL | let _ = vec![s4, s4, s4].into_iter().into_iter();
|
LL | let _ = vec![s4, s4, s4].into_iter().into_iter();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![s4, s4, s4].into_iter()`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into_iter()`: `vec![s4, s4, s4].into_iter()`
|
||||||
|
|
||||||
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
||||||
--> tests/ui/useless_conversion.rs:185:7
|
--> tests/ui/useless_conversion.rs:187:7
|
||||||
|
|
|
|
||||||
LL | b(vec![1, 2].into_iter());
|
LL | b(vec![1, 2].into_iter());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]`
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]`
|
||||||
|
|
|
|
||||||
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
||||||
--> tests/ui/useless_conversion.rs:175:13
|
--> tests/ui/useless_conversion.rs:177:13
|
||||||
|
|
|
|
||||||
LL | fn b<T: IntoIterator<Item = i32>>(_: T) {}
|
LL | fn b<T: IntoIterator<Item = i32>>(_: T) {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
||||||
--> tests/ui/useless_conversion.rs:186:7
|
--> tests/ui/useless_conversion.rs:188:7
|
||||||
|
|
|
|
||||||
LL | c(vec![1, 2].into_iter());
|
LL | c(vec![1, 2].into_iter());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]`
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]`
|
||||||
|
|
|
|
||||||
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
||||||
--> tests/ui/useless_conversion.rs:176:18
|
--> tests/ui/useless_conversion.rs:178:18
|
||||||
|
|
|
|
||||||
LL | fn c(_: impl IntoIterator<Item = i32>) {}
|
LL | fn c(_: impl IntoIterator<Item = i32>) {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
||||||
--> tests/ui/useless_conversion.rs:187:7
|
--> tests/ui/useless_conversion.rs:189:7
|
||||||
|
|
|
|
||||||
LL | d(vec![1, 2].into_iter());
|
LL | d(vec![1, 2].into_iter());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]`
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![1, 2]`
|
||||||
|
|
|
|
||||||
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
||||||
--> tests/ui/useless_conversion.rs:179:12
|
--> tests/ui/useless_conversion.rs:181:12
|
||||||
|
|
|
|
||||||
LL | T: IntoIterator<Item = i32>,
|
LL | T: IntoIterator<Item = i32>,
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
||||||
--> tests/ui/useless_conversion.rs:190:7
|
--> tests/ui/useless_conversion.rs:192:7
|
||||||
|
|
|
|
||||||
LL | b(vec![1, 2].into_iter().into_iter());
|
LL | b(vec![1, 2].into_iter().into_iter());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`s: `vec![1, 2]`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`s: `vec![1, 2]`
|
||||||
|
|
|
|
||||||
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
||||||
--> tests/ui/useless_conversion.rs:175:13
|
--> tests/ui/useless_conversion.rs:177:13
|
||||||
|
|
|
|
||||||
LL | fn b<T: IntoIterator<Item = i32>>(_: T) {}
|
LL | fn b<T: IntoIterator<Item = i32>>(_: T) {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
||||||
--> tests/ui/useless_conversion.rs:191:7
|
--> tests/ui/useless_conversion.rs:193:7
|
||||||
|
|
|
|
||||||
LL | b(vec![1, 2].into_iter().into_iter().into_iter());
|
LL | b(vec![1, 2].into_iter().into_iter().into_iter());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`s: `vec![1, 2]`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`s: `vec![1, 2]`
|
||||||
|
|
|
|
||||||
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
||||||
--> tests/ui/useless_conversion.rs:175:13
|
--> tests/ui/useless_conversion.rs:177:13
|
||||||
|
|
|
|
||||||
LL | fn b<T: IntoIterator<Item = i32>>(_: T) {}
|
LL | fn b<T: IntoIterator<Item = i32>>(_: T) {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
||||||
--> tests/ui/useless_conversion.rs:237:24
|
--> tests/ui/useless_conversion.rs:239:24
|
||||||
|
|
|
|
||||||
LL | foo2::<i32, _>([1, 2, 3].into_iter());
|
LL | foo2::<i32, _>([1, 2, 3].into_iter());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2, 3]`
|
| ^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2, 3]`
|
||||||
|
|
|
|
||||||
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
||||||
--> tests/ui/useless_conversion.rs:216:12
|
--> tests/ui/useless_conversion.rs:218:12
|
||||||
|
|
|
|
||||||
LL | I: IntoIterator<Item = i32> + Helper<X>,
|
LL | I: IntoIterator<Item = i32> + Helper<X>,
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
||||||
--> tests/ui/useless_conversion.rs:245:14
|
--> tests/ui/useless_conversion.rs:247:14
|
||||||
|
|
|
|
||||||
LL | foo3([1, 2, 3].into_iter());
|
LL | foo3([1, 2, 3].into_iter());
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2, 3]`
|
| ^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2, 3]`
|
||||||
|
|
|
|
||||||
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
||||||
--> tests/ui/useless_conversion.rs:225:12
|
--> tests/ui/useless_conversion.rs:227:12
|
||||||
|
|
|
|
||||||
LL | I: IntoIterator<Item = i32>,
|
LL | I: IntoIterator<Item = i32>,
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
||||||
--> tests/ui/useless_conversion.rs:254:16
|
--> tests/ui/useless_conversion.rs:256:16
|
||||||
|
|
|
|
||||||
LL | S1.foo([1, 2].into_iter());
|
LL | S1.foo([1, 2].into_iter());
|
||||||
| ^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2]`
|
| ^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `[1, 2]`
|
||||||
|
|
|
|
||||||
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
||||||
--> tests/ui/useless_conversion.rs:251:27
|
--> tests/ui/useless_conversion.rs:253:27
|
||||||
|
|
|
|
||||||
LL | pub fn foo<I: IntoIterator>(&self, _: I) {}
|
LL | pub fn foo<I: IntoIterator>(&self, _: I) {}
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
|
||||||
--> tests/ui/useless_conversion.rs:273:44
|
--> tests/ui/useless_conversion.rs:275:44
|
||||||
|
|
|
|
||||||
LL | v0.into_iter().interleave_shortest(v1.into_iter());
|
LL | v0.into_iter().interleave_shortest(v1.into_iter());
|
||||||
| ^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `v1`
|
| ^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `v1`
|
||||||
|
|
|
|
||||||
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
|
||||||
--> tests/ui/useless_conversion.rs:260:20
|
--> tests/ui/useless_conversion.rs:262:20
|
||||||
|
|
|
|
||||||
LL | J: IntoIterator,
|
LL | J: IntoIterator,
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
Loading…
Reference in New Issue
Block a user