Merge remote-tracking branch 'upstream/master' into rustup

This commit is contained in:
Philipp Krones 2022-09-28 14:27:32 +02:00
commit bbcde66685
No known key found for this signature in database
GPG key ID: 1CA0DF2AF59D68A5
323 changed files with 3669 additions and 1716 deletions

View file

@ -2,11 +2,12 @@
clippy::assign_op_pattern,
clippy::erasing_op,
clippy::identity_op,
clippy::op_ref,
clippy::unnecessary_owned_empty_strings,
arithmetic_overflow,
unconditional_panic
)]
#![feature(inline_const, saturating_int_impl)]
#![feature(const_mut_refs, inline_const, saturating_int_impl)]
#![warn(clippy::arithmetic_side_effects)]
use core::num::{Saturating, Wrapping};
@ -79,33 +80,50 @@ pub fn const_ops_should_not_trigger_the_lint() {
const _: i32 = 1 + 1;
let _ = const { 1 + 1 };
const _: i32 = { let mut n = -1; n = -(-1); n = -n; n };
let _ = const { let mut n = -1; n = -(-1); n = -n; n };
const _: i32 = { let mut n = 1; n = -1; n = -(-1); n = -n; n };
let _ = const { let mut n = 1; n = -1; n = -(-1); n = -n; n };
}
pub fn non_overflowing_runtime_ops_or_ops_already_handled_by_the_compiler() {
pub fn non_overflowing_ops_or_ops_already_handled_by_the_compiler_should_not_trigger_the_lint() {
let mut _n = i32::MAX;
// Assign
_n += 0;
_n += &0;
_n -= 0;
_n -= &0;
_n /= 99;
_n /= &99;
_n %= 99;
_n %= &99;
_n *= 0;
_n *= &0;
_n *= 1;
_n *= &1;
// Binary
_n = _n + 0;
_n = _n + &0;
_n = 0 + _n;
_n = &0 + _n;
_n = _n - 0;
_n = _n - &0;
_n = 0 - _n;
_n = &0 - _n;
_n = _n / 99;
_n = _n / &99;
_n = _n % 99;
_n = _n % &99;
_n = _n * 0;
_n = _n * &0;
_n = 0 * _n;
_n = &0 * _n;
_n = _n * 1;
_n = _n * &1;
_n = 1 * _n;
_n = &1 * _n;
_n = 23 + 85;
_n = &23 + &85;
// Unary
_n = -1;
@ -117,23 +135,37 @@ pub fn overflowing_runtime_ops() {
// Assign
_n += 1;
_n += &1;
_n -= 1;
_n -= &1;
_n /= 0;
_n /= &0;
_n %= 0;
_n %= &0;
_n *= 2;
_n *= &2;
// Binary
_n = _n + 1;
_n = _n + &1;
_n = 1 + _n;
_n = &1 + _n;
_n = _n - 1;
_n = _n - &1;
_n = 1 - _n;
_n = &1 - _n;
_n = _n / 0;
_n = _n / &0;
_n = _n % 0;
_n = _n % &0;
_n = _n * 2;
_n = _n * &2;
_n = 2 * _n;
_n = &2 * _n;
// Unary
_n = -_n;
_n = -&_n;
}
fn main() {}

View file

@ -1,5 +1,5 @@
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:119:5
--> $DIR/arithmetic_side_effects.rs:137:5
|
LL | _n += 1;
| ^^^^^^^
@ -7,82 +7,166 @@ LL | _n += 1;
= note: `-D clippy::arithmetic-side-effects` implied by `-D warnings`
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:120:5
--> $DIR/arithmetic_side_effects.rs:138:5
|
LL | _n += &1;
| ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:139:5
|
LL | _n -= 1;
| ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:121:5
--> $DIR/arithmetic_side_effects.rs:140:5
|
LL | _n -= &1;
| ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:141:5
|
LL | _n /= 0;
| ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:122:5
--> $DIR/arithmetic_side_effects.rs:142:5
|
LL | _n /= &0;
| ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:143:5
|
LL | _n %= 0;
| ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:123:5
--> $DIR/arithmetic_side_effects.rs:144:5
|
LL | _n %= &0;
| ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:145:5
|
LL | _n *= 2;
| ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:126:10
--> $DIR/arithmetic_side_effects.rs:146:5
|
LL | _n *= &2;
| ^^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:149:10
|
LL | _n = _n + 1;
| ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:127:10
--> $DIR/arithmetic_side_effects.rs:150:10
|
LL | _n = _n + &1;
| ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:151:10
|
LL | _n = 1 + _n;
| ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:128:10
--> $DIR/arithmetic_side_effects.rs:152:10
|
LL | _n = &1 + _n;
| ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:153:10
|
LL | _n = _n - 1;
| ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:129:10
--> $DIR/arithmetic_side_effects.rs:154:10
|
LL | _n = _n - &1;
| ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:155:10
|
LL | _n = 1 - _n;
| ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:130:10
--> $DIR/arithmetic_side_effects.rs:156:10
|
LL | _n = &1 - _n;
| ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:157:10
|
LL | _n = _n / 0;
| ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:131:10
--> $DIR/arithmetic_side_effects.rs:158:10
|
LL | _n = _n / &0;
| ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:159:10
|
LL | _n = _n % 0;
| ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:132:10
--> $DIR/arithmetic_side_effects.rs:160:10
|
LL | _n = _n % &0;
| ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:161:10
|
LL | _n = _n * 2;
| ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:133:10
--> $DIR/arithmetic_side_effects.rs:162:10
|
LL | _n = _n * &2;
| ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:163:10
|
LL | _n = 2 * _n;
| ^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:136:10
--> $DIR/arithmetic_side_effects.rs:164:10
|
LL | _n = &2 * _n;
| ^^^^^^^
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:167:10
|
LL | _n = -_n;
| ^^^
error: aborting due to 14 previous errors
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:168:10
|
LL | _n = -&_n;
| ^^^^
error: aborting due to 28 previous errors

View file

@ -15,7 +15,7 @@ macro_rules! boxit {
}
fn test_macro() {
boxit!(Vec::new(), Vec<u8>);
boxit!(vec![1], Vec<u8>);
}
fn test1(foo: Box<Vec<bool>>) {}
@ -50,7 +50,7 @@ fn test_local_not_linted() {
pub fn pub_test(foo: Box<Vec<bool>>) {}
pub fn pub_test_ret() -> Box<Vec<bool>> {
Box::new(Vec::new())
Box::default()
}
fn main() {}

31
tests/ui/box_default.rs Normal file
View file

@ -0,0 +1,31 @@
#![warn(clippy::box_default)]
#[derive(Default)]
struct ImplementsDefault;
struct OwnDefault;
impl OwnDefault {
fn default() -> Self {
Self
}
}
macro_rules! outer {
($e: expr) => {
$e
};
}
fn main() {
let _string: Box<String> = Box::new(Default::default());
let _byte = Box::new(u8::default());
let _vec = Box::new(Vec::<u8>::new());
let _impl = Box::new(ImplementsDefault::default());
let _impl2 = Box::new(<ImplementsDefault as Default>::default());
let _impl3: Box<ImplementsDefault> = Box::new(Default::default());
let _own = Box::new(OwnDefault::default()); // should not lint
let _in_macro = outer!(Box::new(String::new()));
// false negative: default is from different expansion
let _vec2: Box<Vec<ImplementsDefault>> = Box::new(vec![]);
}

View file

@ -0,0 +1,59 @@
error: `Box::new(_)` of default value
--> $DIR/box_default.rs:21:32
|
LL | let _string: Box<String> = Box::new(Default::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::box-default` implied by `-D warnings`
= help: use `Box::default()` instead
error: `Box::new(_)` of default value
--> $DIR/box_default.rs:22:17
|
LL | let _byte = Box::new(u8::default());
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `Box::default()` instead
error: `Box::new(_)` of default value
--> $DIR/box_default.rs:23:16
|
LL | let _vec = Box::new(Vec::<u8>::new());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `Box::default()` instead
error: `Box::new(_)` of default value
--> $DIR/box_default.rs:24:17
|
LL | let _impl = Box::new(ImplementsDefault::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `Box::default()` instead
error: `Box::new(_)` of default value
--> $DIR/box_default.rs:25:18
|
LL | let _impl2 = Box::new(<ImplementsDefault as Default>::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `Box::default()` instead
error: `Box::new(_)` of default value
--> $DIR/box_default.rs:26:42
|
LL | let _impl3: Box<ImplementsDefault> = Box::new(Default::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `Box::default()` instead
error: `Box::new(_)` of default value
--> $DIR/box_default.rs:28:28
|
LL | let _in_macro = outer!(Box::new(String::new()));
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `Box::default()` instead
error: aborting due to 7 previous errors

View file

@ -0,0 +1,3 @@
const UNINIT: core::mem::MaybeUninit<core::cell::Cell<&'static ()>> = core::mem::MaybeUninit::uninit();
fn main() {}

View file

@ -0,0 +1,5 @@
#![feature(unsized_fn_params)]
pub fn f0(_f: dyn FnOnce()) {}
fn main() {}

View file

@ -1,7 +1,6 @@
#![allow(dead_code)]
#![warn(clippy::expl_impl_clone_on_copy)]
#[derive(Copy)]
struct Qux;

View file

@ -1,5 +1,5 @@
error: you are implementing `Clone` explicitly on a `Copy` type
--> $DIR/derive.rs:8:1
--> $DIR/derive.rs:7:1
|
LL | / impl Clone for Qux {
LL | | fn clone(&self) -> Self {
@ -10,7 +10,7 @@ LL | | }
|
= note: `-D clippy::expl-impl-clone-on-copy` implied by `-D warnings`
note: consider deriving `Clone` or removing `Copy`
--> $DIR/derive.rs:8:1
--> $DIR/derive.rs:7:1
|
LL | / impl Clone for Qux {
LL | | fn clone(&self) -> Self {
@ -20,7 +20,7 @@ LL | | }
| |_^
error: you are implementing `Clone` explicitly on a `Copy` type
--> $DIR/derive.rs:32:1
--> $DIR/derive.rs:31:1
|
LL | / impl<'a> Clone for Lt<'a> {
LL | | fn clone(&self) -> Self {
@ -30,7 +30,7 @@ LL | | }
| |_^
|
note: consider deriving `Clone` or removing `Copy`
--> $DIR/derive.rs:32:1
--> $DIR/derive.rs:31:1
|
LL | / impl<'a> Clone for Lt<'a> {
LL | | fn clone(&self) -> Self {
@ -40,7 +40,7 @@ LL | | }
| |_^
error: you are implementing `Clone` explicitly on a `Copy` type
--> $DIR/derive.rs:43:1
--> $DIR/derive.rs:42:1
|
LL | / impl Clone for BigArray {
LL | | fn clone(&self) -> Self {
@ -50,7 +50,7 @@ LL | | }
| |_^
|
note: consider deriving `Clone` or removing `Copy`
--> $DIR/derive.rs:43:1
--> $DIR/derive.rs:42:1
|
LL | / impl Clone for BigArray {
LL | | fn clone(&self) -> Self {
@ -60,7 +60,7 @@ LL | | }
| |_^
error: you are implementing `Clone` explicitly on a `Copy` type
--> $DIR/derive.rs:54:1
--> $DIR/derive.rs:53:1
|
LL | / impl Clone for FnPtr {
LL | | fn clone(&self) -> Self {
@ -70,7 +70,7 @@ LL | | }
| |_^
|
note: consider deriving `Clone` or removing `Copy`
--> $DIR/derive.rs:54:1
--> $DIR/derive.rs:53:1
|
LL | / impl Clone for FnPtr {
LL | | fn clone(&self) -> Self {
@ -80,7 +80,7 @@ LL | | }
| |_^
error: you are implementing `Clone` explicitly on a `Copy` type
--> $DIR/derive.rs:74:1
--> $DIR/derive.rs:73:1
|
LL | / impl<T: Clone> Clone for Generic2<T> {
LL | | fn clone(&self) -> Self {
@ -90,7 +90,7 @@ LL | | }
| |_^
|
note: consider deriving `Clone` or removing `Copy`
--> $DIR/derive.rs:74:1
--> $DIR/derive.rs:73:1
|
LL | / impl<T: Clone> Clone for Generic2<T> {
LL | | fn clone(&self) -> Self {

View file

@ -64,3 +64,23 @@ fn main() {
let a5 = a1.clone();
forget(a5);
}
#[allow(unused)]
#[allow(clippy::unit_cmp)]
fn issue9482(x: u8) {
fn println_and<T>(t: T) -> T {
println!("foo");
t
}
match x {
0 => drop(println_and(12)), // Don't lint (copy type), we only care about side-effects
1 => drop(println_and(String::new())), // Don't lint (no copy type), we only care about side-effects
2 => {
drop(println_and(13)); // Lint, even if we only care about the side-effect, it's already in a block
},
3 if drop(println_and(14)) == () => (), // Lint, idiomatic use is only in body of `Arm`
4 => drop(2), // Lint, not a fn/method call
_ => (),
}
}

View file

@ -72,5 +72,41 @@ note: argument has type `SomeStruct`
LL | forget(s4);
| ^^
error: aborting due to 6 previous errors
error: calls to `std::mem::drop` with a value that implements `Copy`. Dropping a copy leaves the original intact
--> $DIR/drop_forget_copy.rs:80:13
|
LL | drop(println_and(13)); // Lint, even if we only care about the side-effect, it's already in a block
| ^^^^^^^^^^^^^^^^^^^^^
|
note: argument has type `i32`
--> $DIR/drop_forget_copy.rs:80:18
|
LL | drop(println_and(13)); // Lint, even if we only care about the side-effect, it's already in a block
| ^^^^^^^^^^^^^^^
error: calls to `std::mem::drop` with a value that implements `Copy`. Dropping a copy leaves the original intact
--> $DIR/drop_forget_copy.rs:82:14
|
LL | 3 if drop(println_and(14)) == () => (), // Lint, idiomatic use is only in body of `Arm`
| ^^^^^^^^^^^^^^^^^^^^^
|
note: argument has type `i32`
--> $DIR/drop_forget_copy.rs:82:19
|
LL | 3 if drop(println_and(14)) == () => (), // Lint, idiomatic use is only in body of `Arm`
| ^^^^^^^^^^^^^^^
error: calls to `std::mem::drop` with a value that implements `Copy`. Dropping a copy leaves the original intact
--> $DIR/drop_forget_copy.rs:83:14
|
LL | 4 => drop(2), // Lint, not a fn/method call
| ^^^^^^^
|
note: argument has type `i32`
--> $DIR/drop_forget_copy.rs:83:19
|
LL | 4 => drop(2), // Lint, not a fn/method call
| ^
error: aborting due to 9 previous errors

View file

@ -22,9 +22,9 @@ mod rustc_ok {
#[expect(illegal_floating_point_literal_pattern)]
match x {
5.0 => {}
6.0 => {}
_ => {}
5.0 => {},
6.0 => {},
_ => {},
}
}
}
@ -38,9 +38,9 @@ mod rustc_warn {
#[expect(illegal_floating_point_literal_pattern)]
match x {
5 => {}
6 => {}
_ => {}
5 => {},
6 => {},
_ => {},
}
}
}

View file

@ -232,4 +232,41 @@ fn issue_9361() -> i32 {
return 1 + 2;
}
fn issue8336(x: i32) -> bool {
if x > 0 {
println!("something");
true
} else {
false
}
}
fn issue8156(x: u8) -> u64 {
match x {
80 => {
10
},
_ => {
100
},
}
}
// Ideally the compiler should throw `unused_braces` in this case
fn issue9192() -> i32 {
{
0
}
}
fn issue9503(x: usize) -> isize {
unsafe {
if x > 12 {
*(x as *const isize)
} else {
!*(x as *const isize)
}
}
}
fn main() {}

View file

@ -232,4 +232,41 @@ fn issue_9361() -> i32 {
return 1 + 2;
}
fn issue8336(x: i32) -> bool {
if x > 0 {
println!("something");
return true;
} else {
return false;
};
}
fn issue8156(x: u8) -> u64 {
match x {
80 => {
return 10;
},
_ => {
return 100;
},
};
}
// Ideally the compiler should throw `unused_braces` in this case
fn issue9192() -> i32 {
{
return 0;
};
}
fn issue9503(x: usize) -> isize {
unsafe {
if x > 12 {
return *(x as *const isize);
} else {
return !*(x as *const isize);
};
};
}
fn main() {}

View file

@ -2,225 +2,354 @@ error: unneeded `return` statement
--> $DIR/needless_return.rs:26:5
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
| ^^^^^^^^^^^
|
= note: `-D clippy::needless-return` implied by `-D warnings`
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:30:5
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
| ^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:35:9
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
| ^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:37:9
|
LL | return false;
| ^^^^^^^^^^^^^ help: remove `return`: `false`
| ^^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:43:17
|
LL | true => return false,
| ^^^^^^^^^^^^ help: remove `return`: `false`
| ^^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:45:13
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
| ^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:52:9
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
| ^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:54:16
|
LL | let _ = || return true;
| ^^^^^^^^^^^ help: remove `return`: `true`
| ^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:58:5
|
LL | return the_answer!();
| ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `the_answer!()`
| ^^^^^^^^^^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:62:5
|
LL | return;
| ^^^^^^^ help: remove `return`
| ^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:67:9
|
LL | return;
| ^^^^^^^ help: remove `return`
| ^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:69:9
|
LL | return;
| ^^^^^^^ help: remove `return`
| ^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:76:14
|
LL | _ => return,
| ^^^^^^ help: replace `return` with a unit value: `()`
| ^^^^^^
|
= help: replace `return` with a unit value
error: unneeded `return` statement
--> $DIR/needless_return.rs:85:13
|
LL | return;
| ^^^^^^^ help: remove `return`
| ^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:87:14
|
LL | _ => return,
| ^^^^^^ help: replace `return` with a unit value: `()`
| ^^^^^^
|
= help: replace `return` with a unit value
error: unneeded `return` statement
--> $DIR/needless_return.rs:100:9
|
LL | return String::from("test");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::from("test")`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:102:9
|
LL | return String::new();
| ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::new()`
| ^^^^^^^^^^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:124:32
|
LL | bar.unwrap_or_else(|_| return)
| ^^^^^^ help: replace `return` with an empty block: `{}`
| ^^^^^^
|
= help: replace `return` with an empty block
error: unneeded `return` statement
--> $DIR/needless_return.rs:129:13
|
LL | return;
| ^^^^^^^ help: remove `return`
| ^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:131:20
|
LL | let _ = || return;
| ^^^^^^ help: replace `return` with an empty block: `{}`
| ^^^^^^
|
= help: replace `return` with an empty block
error: unneeded `return` statement
--> $DIR/needless_return.rs:137:32
|
LL | res.unwrap_or_else(|_| return Foo)
| ^^^^^^^^^^ help: remove `return`: `Foo`
| ^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:146:5
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
| ^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:150:5
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
| ^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:155:9
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
| ^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:157:9
|
LL | return false;
| ^^^^^^^^^^^^^ help: remove `return`: `false`
| ^^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:163:17
|
LL | true => return false,
| ^^^^^^^^^^^^ help: remove `return`: `false`
| ^^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:165:13
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
| ^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:172:9
|
LL | return true;
| ^^^^^^^^^^^^ help: remove `return`: `true`
| ^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:174:16
|
LL | let _ = || return true;
| ^^^^^^^^^^^ help: remove `return`: `true`
| ^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:178:5
|
LL | return the_answer!();
| ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `the_answer!()`
| ^^^^^^^^^^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:182:5
|
LL | return;
| ^^^^^^^ help: remove `return`
| ^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:187:9
|
LL | return;
| ^^^^^^^ help: remove `return`
| ^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:189:9
|
LL | return;
| ^^^^^^^ help: remove `return`
| ^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:196:14
|
LL | _ => return,
| ^^^^^^ help: replace `return` with a unit value: `()`
| ^^^^^^
|
= help: replace `return` with a unit value
error: unneeded `return` statement
--> $DIR/needless_return.rs:209:9
|
LL | return String::from("test");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::from("test")`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:211:9
|
LL | return String::new();
| ^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `String::new()`
| ^^^^^^^^^^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:227:5
|
LL | return format!("Hello {}", "world!");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `format!("Hello {}", "world!")`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: remove `return`
error: aborting due to 37 previous errors
error: unneeded `return` statement
--> $DIR/needless_return.rs:238:9
|
LL | return true;
| ^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:240:9
|
LL | return false;
| ^^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:247:13
|
LL | return 10;
| ^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:250:13
|
LL | return 100;
| ^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:258:9
|
LL | return 0;
| ^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:265:13
|
LL | return *(x as *const isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: remove `return`
error: unneeded `return` statement
--> $DIR/needless_return.rs:267:13
|
LL | return !*(x as *const isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: remove `return`
error: aborting due to 44 previous errors

View file

@ -203,6 +203,32 @@ pub fn test17() {
};
}
// Issue #9356: `continue` in else branch of let..else
pub fn test18() {
let x = Some(0);
let y = 0;
// might loop
let _ = loop {
let Some(x) = x else {
if y > 0 {
continue;
} else {
return;
}
};
break x;
};
// never loops
let _ = loop {
let Some(x) = x else {
return;
};
break x;
};
}
fn main() {
test1();
test2();

View file

@ -101,5 +101,18 @@ LL | | break 'label;
LL | | }
| |_________^
error: aborting due to 9 previous errors
error: this loop never actually loops
--> $DIR/never_loop.rs:223:13
|
LL | let _ = loop {
| _____________^
LL | | let Some(x) = x else {
LL | | return;
LL | | };
LL | |
LL | | break x;
LL | | };
| |_____^
error: aborting due to 10 previous errors

View file

@ -223,3 +223,12 @@ fn pattern() -> Result<(), PatternedError> {
}
fn main() {}
// should not lint, `?` operator not available in const context
const fn issue9175(option: Option<()>) -> Option<()> {
if option.is_none() {
return None;
}
//stuff
Some(())
}

View file

@ -259,3 +259,12 @@ fn pattern() -> Result<(), PatternedError> {
}
fn main() {}
// should not lint, `?` operator not available in const context
const fn issue9175(option: Option<()>) -> Option<()> {
if option.is_none() {
return None;
}
//stuff
Some(())
}

View file

@ -99,6 +99,16 @@ LL | | }
|
= help: consider implementing the trait `std::cmp::Ord` or choosing a less ambiguous method name
error: method `default` can be confused for the standard trait method `std::default::Default::default`
--> $DIR/method_list_1.rs:65:5
|
LL | / pub fn default() -> Self {
LL | | unimplemented!()
LL | | }
| |_____^
|
= help: consider implementing the trait `std::default::Default` or choosing a less ambiguous method name
error: method `deref` can be confused for the standard trait method `std::ops::Deref::deref`
--> $DIR/method_list_1.rs:69:5
|
@ -139,5 +149,5 @@ LL | | }
|
= help: consider implementing the trait `std::ops::Drop` or choosing a less ambiguous method name
error: aborting due to 14 previous errors
error: aborting due to 15 previous errors

View file

@ -24,6 +24,12 @@ fn std_instead_of_core() {
let cell_absolute = ::std::cell::Cell::new(8u32);
let _ = std::env!("PATH");
// do not lint until `error_in_core` is stable
use std::error::Error;
// lint items re-exported from private modules, `core::iter::traits::iterator::Iterator`
use std::iter::Iterator;
}
#[warn(clippy::std_instead_of_alloc)]

View file

@ -63,9 +63,17 @@ LL | let cell_absolute = ::std::cell::Cell::new(8u32);
|
= help: consider importing the item from `core`
error: used import from `std` instead of `alloc`
error: used import from `std` instead of `core`
--> $DIR/std_instead_of_core.rs:32:9
|
LL | use std::iter::Iterator;
| ^^^^^^^^^^^^^^^^^^^
|
= help: consider importing the item from `core`
error: used import from `std` instead of `alloc`
--> $DIR/std_instead_of_core.rs:38:9
|
LL | use std::vec;
| ^^^^^^^^
|
@ -73,7 +81,7 @@ LL | use std::vec;
= help: consider importing the item from `alloc`
error: used import from `std` instead of `alloc`
--> $DIR/std_instead_of_core.rs:33:9
--> $DIR/std_instead_of_core.rs:39:9
|
LL | use std::vec::Vec;
| ^^^^^^^^^^^^^
@ -81,7 +89,7 @@ LL | use std::vec::Vec;
= help: consider importing the item from `alloc`
error: used import from `alloc` instead of `core`
--> $DIR/std_instead_of_core.rs:38:9
--> $DIR/std_instead_of_core.rs:44:9
|
LL | use alloc::slice::from_ref;
| ^^^^^^^^^^^^^^^^^^^^^^
@ -89,5 +97,5 @@ LL | use alloc::slice::from_ref;
= note: `-D clippy::alloc-instead-of-core` implied by `-D warnings`
= help: consider importing the item from `core`
error: aborting due to 11 previous errors
error: aborting due to 12 previous errors

View file

@ -1,5 +1,4 @@
#![warn(clippy::temporary_assignment)]
#![allow(const_item_mutation)]
use std::ops::{Deref, DerefMut};

View file

@ -1,5 +1,5 @@
error: assignment to temporary
--> $DIR/temporary_assignment.rs:48:5
--> $DIR/temporary_assignment.rs:47:5
|
LL | Struct { field: 0 }.field = 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -7,7 +7,7 @@ LL | Struct { field: 0 }.field = 1;
= note: `-D clippy::temporary-assignment` implied by `-D warnings`
error: assignment to temporary
--> $DIR/temporary_assignment.rs:49:5
--> $DIR/temporary_assignment.rs:48:5
|
LL | / MultiStruct {
LL | | structure: Struct { field: 0 },
@ -17,13 +17,13 @@ LL | | .field = 1;
| |______________^
error: assignment to temporary
--> $DIR/temporary_assignment.rs:54:5
--> $DIR/temporary_assignment.rs:53:5
|
LL | ArrayStruct { array: [0] }.array[0] = 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: assignment to temporary
--> $DIR/temporary_assignment.rs:55:5
--> $DIR/temporary_assignment.rs:54:5
|
LL | (0, 0).0 = 1;
| ^^^^^^^^^^^^

View file

@ -91,4 +91,10 @@ fn main() {
vec1.set_len(200);
vec2.set_len(200);
}
// set_len(0) should not be detected
let mut vec: Vec<u8> = Vec::with_capacity(1000);
unsafe {
vec.set_len(0);
}
}

View file

@ -0,0 +1,168 @@
// run-rustfix
#![allow(clippy::eq_op)]
#![allow(clippy::format_in_format_args)]
#![allow(clippy::print_literal)]
#![allow(named_arguments_used_positionally)]
#![allow(unused_variables, unused_imports, unused_macros)]
#![warn(clippy::uninlined_format_args)]
#![feature(custom_inner_attributes)]
macro_rules! no_param_str {
() => {
"{}"
};
}
macro_rules! pass_through {
($expr:expr) => {
$expr
};
}
macro_rules! my_println {
($($args:tt),*) => {{
println!($($args),*)
}};
}
macro_rules! my_println_args {
($($args:tt),*) => {{
println!("foo: {}", format_args!($($args),*))
}};
}
fn tester(fn_arg: i32) {
let local_i32 = 1;
let local_f64 = 2.0;
let local_opt: Option<i32> = Some(3);
let width = 4;
let prec = 5;
let val = 6;
// make sure this file hasn't been corrupted with tabs converted to spaces
// let _ = ' '; // <- this is a single tab character
let _: &[u8; 3] = b" "; // <- <tab><space><tab>
println!("val='{local_i32}'");
println!("val='{local_i32}'"); // 3 spaces
println!("val='{local_i32}'"); // tab
println!("val='{local_i32}'"); // space+tab
println!("val='{local_i32}'"); // tab+space
println!(
"val='{local_i32}'"
);
println!("{local_i32}");
println!("{fn_arg}");
println!("{local_i32:?}");
println!("{local_i32:#?}");
println!("{local_i32:4}");
println!("{local_i32:04}");
println!("{local_i32:<3}");
println!("{local_i32:#010x}");
println!("{local_f64:.1}");
println!("Hello {} is {local_f64:.local_i32$}", "x");
println!("Hello {local_i32} is {local_f64:.*}", 5);
println!("Hello {local_i32} is {local_f64:.*}", 5);
println!("{local_i32} {local_f64}");
println!("{local_i32}, {}", local_opt.unwrap());
println!("{val}");
println!("{val}");
println!("{} {1}", local_i32, 42);
println!("val='{local_i32}'");
println!("val='{local_i32}'");
println!("val='{local_i32}'");
println!("val='{fn_arg}'");
println!("{local_i32}");
println!("{local_i32:?}");
println!("{local_i32:#?}");
println!("{local_i32:04}");
println!("{local_i32:<3}");
println!("{local_i32:#010x}");
println!("{local_f64:.1}");
println!("{local_i32} {local_i32}");
println!("{local_f64} {local_i32} {local_i32} {local_f64}");
println!("{local_i32} {local_f64}");
println!("{local_f64} {local_i32}");
println!("{local_f64} {local_i32} {local_f64} {local_i32}");
println!("{1} {0}", "str", local_i32);
println!("{local_i32}");
println!("{local_i32:width$}");
println!("{local_i32:width$}");
println!("{local_i32:.prec$}");
println!("{local_i32:.prec$}");
println!("{val:val$}");
println!("{val:val$}");
println!("{val:val$.val$}");
println!("{val:val$.val$}");
println!("{val:val$.val$}");
println!("{val:val$.val$}");
println!("{val:val$.val$}");
println!("{val:val$.val$}");
println!("{val:val$.val$}");
println!("{val:val$.val$}");
println!("{width:width$}");
println!("{local_i32:width$}");
println!("{width:width$}");
println!("{local_i32:width$}");
println!("{prec:.prec$}");
println!("{local_i32:.prec$}");
println!("{prec:.prec$}");
println!("{local_i32:.prec$}");
println!("{width:width$.prec$}");
println!("{width:width$.prec$}");
println!("{local_f64:width$.prec$}");
println!("{local_f64:width$.prec$} {local_f64} {width} {prec}");
println!(
"{local_i32:width$.prec$} {local_i32:prec$.width$} {width:local_i32$.prec$} {width:prec$.local_i32$} {prec:local_i32$.width$} {prec:width$.local_i32$}",
);
println!(
"{0:1$.2$} {0:2$.1$} {1:0$.2$} {1:2$.0$} {2:0$.1$} {2:1$.0$} {3}",
local_i32,
width,
prec,
1 + 2
);
println!("Width = {local_i32}, value with width = {local_f64:local_i32$}");
println!("{local_i32:width$.prec$}");
println!("{width:width$.prec$}");
println!("{}", format!("{local_i32}"));
my_println!("{}", local_i32);
my_println_args!("{}", local_i32);
// these should NOT be modified by the lint
println!(concat!("nope ", "{}"), local_i32);
println!("val='{local_i32}'");
println!("val='{local_i32 }'");
println!("val='{local_i32 }'"); // with tab
println!("val='{local_i32\n}'");
println!("{}", usize::MAX);
println!("{}", local_opt.unwrap());
println!(
"val='{local_i32
}'"
);
println!(no_param_str!(), local_i32);
// FIXME: bugs!
// println!(pass_through!("foo={local_i32}"), local_i32 = local_i32);
// println!(pass_through!("foo={}"), local_i32);
// println!(indoc!("foo={}"), local_i32);
// printdoc!("foo={}", local_i32);
}
fn main() {
tester(42);
}
fn _under_msrv() {
#![clippy::msrv = "1.57"]
let local_i32 = 1;
println!("don't expand='{}'", local_i32);
}
fn _meets_msrv() {
#![clippy::msrv = "1.58"]
let local_i32 = 1;
println!("expand='{local_i32}'");
}

View file

@ -0,0 +1,171 @@
// run-rustfix
#![allow(clippy::eq_op)]
#![allow(clippy::format_in_format_args)]
#![allow(clippy::print_literal)]
#![allow(named_arguments_used_positionally)]
#![allow(unused_variables, unused_imports, unused_macros)]
#![warn(clippy::uninlined_format_args)]
#![feature(custom_inner_attributes)]
macro_rules! no_param_str {
() => {
"{}"
};
}
macro_rules! pass_through {
($expr:expr) => {
$expr
};
}
macro_rules! my_println {
($($args:tt),*) => {{
println!($($args),*)
}};
}
macro_rules! my_println_args {
($($args:tt),*) => {{
println!("foo: {}", format_args!($($args),*))
}};
}
fn tester(fn_arg: i32) {
let local_i32 = 1;
let local_f64 = 2.0;
let local_opt: Option<i32> = Some(3);
let width = 4;
let prec = 5;
let val = 6;
// make sure this file hasn't been corrupted with tabs converted to spaces
// let _ = ' '; // <- this is a single tab character
let _: &[u8; 3] = b" "; // <- <tab><space><tab>
println!("val='{}'", local_i32);
println!("val='{ }'", local_i32); // 3 spaces
println!("val='{ }'", local_i32); // tab
println!("val='{ }'", local_i32); // space+tab
println!("val='{ }'", local_i32); // tab+space
println!(
"val='{
}'",
local_i32
);
println!("{}", local_i32);
println!("{}", fn_arg);
println!("{:?}", local_i32);
println!("{:#?}", local_i32);
println!("{:4}", local_i32);
println!("{:04}", local_i32);
println!("{:<3}", local_i32);
println!("{:#010x}", local_i32);
println!("{:.1}", local_f64);
println!("Hello {} is {:.*}", "x", local_i32, local_f64);
println!("Hello {} is {:.*}", local_i32, 5, local_f64);
println!("Hello {} is {2:.*}", local_i32, 5, local_f64);
println!("{} {}", local_i32, local_f64);
println!("{}, {}", local_i32, local_opt.unwrap());
println!("{}", val);
println!("{}", v = val);
println!("{} {1}", local_i32, 42);
println!("val='{\t }'", local_i32);
println!("val='{\n }'", local_i32);
println!("val='{local_i32}'", local_i32 = local_i32);
println!("val='{local_i32}'", local_i32 = fn_arg);
println!("{0}", local_i32);
println!("{0:?}", local_i32);
println!("{0:#?}", local_i32);
println!("{0:04}", local_i32);
println!("{0:<3}", local_i32);
println!("{0:#010x}", local_i32);
println!("{0:.1}", local_f64);
println!("{0} {0}", local_i32);
println!("{1} {} {0} {}", local_i32, local_f64);
println!("{0} {1}", local_i32, local_f64);
println!("{1} {0}", local_i32, local_f64);
println!("{1} {0} {1} {0}", local_i32, local_f64);
println!("{1} {0}", "str", local_i32);
println!("{v}", v = local_i32);
println!("{local_i32:0$}", width);
println!("{local_i32:w$}", w = width);
println!("{local_i32:.0$}", prec);
println!("{local_i32:.p$}", p = prec);
println!("{:0$}", v = val);
println!("{0:0$}", v = val);
println!("{:0$.0$}", v = val);
println!("{0:0$.0$}", v = val);
println!("{0:0$.v$}", v = val);
println!("{0:v$.0$}", v = val);
println!("{v:0$.0$}", v = val);
println!("{v:v$.0$}", v = val);
println!("{v:0$.v$}", v = val);
println!("{v:v$.v$}", v = val);
println!("{:0$}", width);
println!("{:1$}", local_i32, width);
println!("{:w$}", w = width);
println!("{:w$}", local_i32, w = width);
println!("{:.0$}", prec);
println!("{:.1$}", local_i32, prec);
println!("{:.p$}", p = prec);
println!("{:.p$}", local_i32, p = prec);
println!("{:0$.1$}", width, prec);
println!("{:0$.w$}", width, w = prec);
println!("{:1$.2$}", local_f64, width, prec);
println!("{:1$.2$} {0} {1} {2}", local_f64, width, prec);
println!(
"{0:1$.2$} {0:2$.1$} {1:0$.2$} {1:2$.0$} {2:0$.1$} {2:1$.0$}",
local_i32, width, prec,
);
println!(
"{0:1$.2$} {0:2$.1$} {1:0$.2$} {1:2$.0$} {2:0$.1$} {2:1$.0$} {3}",
local_i32,
width,
prec,
1 + 2
);
println!("Width = {}, value with width = {:0$}", local_i32, local_f64);
println!("{:w$.p$}", local_i32, w = width, p = prec);
println!("{:w$.p$}", w = width, p = prec);
println!("{}", format!("{}", local_i32));
my_println!("{}", local_i32);
my_println_args!("{}", local_i32);
// these should NOT be modified by the lint
println!(concat!("nope ", "{}"), local_i32);
println!("val='{local_i32}'");
println!("val='{local_i32 }'");
println!("val='{local_i32 }'"); // with tab
println!("val='{local_i32\n}'");
println!("{}", usize::MAX);
println!("{}", local_opt.unwrap());
println!(
"val='{local_i32
}'"
);
println!(no_param_str!(), local_i32);
// FIXME: bugs!
// println!(pass_through!("foo={local_i32}"), local_i32 = local_i32);
// println!(pass_through!("foo={}"), local_i32);
// println!(indoc!("foo={}"), local_i32);
// printdoc!("foo={}", local_i32);
}
fn main() {
tester(42);
}
fn _under_msrv() {
#![clippy::msrv = "1.57"]
let local_i32 = 1;
println!("don't expand='{}'", local_i32);
}
fn _meets_msrv() {
#![clippy::msrv = "1.58"]
let local_i32 = 1;
println!("expand='{}'", local_i32);
}

View file

@ -0,0 +1,866 @@
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:47:5
|
LL | println!("val='{}'", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::uninlined-format-args` implied by `-D warnings`
help: change this to
|
LL - println!("val='{}'", local_i32);
LL + println!("val='{local_i32}'");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:48:5
|
LL | println!("val='{ }'", local_i32); // 3 spaces
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("val='{ }'", local_i32); // 3 spaces
LL + println!("val='{local_i32}'"); // 3 spaces
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:49:5
|
LL | println!("val='{ }'", local_i32); // tab
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("val='{ }'", local_i32); // tab
LL + println!("val='{local_i32}'"); // tab
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:50:5
|
LL | println!("val='{ }'", local_i32); // space+tab
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("val='{ }'", local_i32); // space+tab
LL + println!("val='{local_i32}'"); // space+tab
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:51:5
|
LL | println!("val='{ }'", local_i32); // tab+space
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("val='{ }'", local_i32); // tab+space
LL + println!("val='{local_i32}'"); // tab+space
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:52:5
|
LL | / println!(
LL | | "val='{
LL | | }'",
LL | | local_i32
LL | | );
| |_____^
|
help: change this to
|
LL - "val='{
LL + "val='{local_i32}'"
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:57:5
|
LL | println!("{}", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{}", local_i32);
LL + println!("{local_i32}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:58:5
|
LL | println!("{}", fn_arg);
| ^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{}", fn_arg);
LL + println!("{fn_arg}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:59:5
|
LL | println!("{:?}", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:?}", local_i32);
LL + println!("{local_i32:?}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:60:5
|
LL | println!("{:#?}", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:#?}", local_i32);
LL + println!("{local_i32:#?}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:61:5
|
LL | println!("{:4}", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:4}", local_i32);
LL + println!("{local_i32:4}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:62:5
|
LL | println!("{:04}", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:04}", local_i32);
LL + println!("{local_i32:04}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:63:5
|
LL | println!("{:<3}", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:<3}", local_i32);
LL + println!("{local_i32:<3}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:64:5
|
LL | println!("{:#010x}", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:#010x}", local_i32);
LL + println!("{local_i32:#010x}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:65:5
|
LL | println!("{:.1}", local_f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:.1}", local_f64);
LL + println!("{local_f64:.1}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:66:5
|
LL | println!("Hello {} is {:.*}", "x", local_i32, local_f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("Hello {} is {:.*}", "x", local_i32, local_f64);
LL + println!("Hello {} is {local_f64:.local_i32$}", "x");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:67:5
|
LL | println!("Hello {} is {:.*}", local_i32, 5, local_f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("Hello {} is {:.*}", local_i32, 5, local_f64);
LL + println!("Hello {local_i32} is {local_f64:.*}", 5);
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:68:5
|
LL | println!("Hello {} is {2:.*}", local_i32, 5, local_f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("Hello {} is {2:.*}", local_i32, 5, local_f64);
LL + println!("Hello {local_i32} is {local_f64:.*}", 5);
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:69:5
|
LL | println!("{} {}", local_i32, local_f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{} {}", local_i32, local_f64);
LL + println!("{local_i32} {local_f64}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:70:5
|
LL | println!("{}, {}", local_i32, local_opt.unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{}, {}", local_i32, local_opt.unwrap());
LL + println!("{local_i32}, {}", local_opt.unwrap());
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:71:5
|
LL | println!("{}", val);
| ^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{}", val);
LL + println!("{val}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:72:5
|
LL | println!("{}", v = val);
| ^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{}", v = val);
LL + println!("{val}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:74:5
|
LL | println!("val='{/t }'", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("val='{/t }'", local_i32);
LL + println!("val='{local_i32}'");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:75:5
|
LL | println!("val='{/n }'", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("val='{/n }'", local_i32);
LL + println!("val='{local_i32}'");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:76:5
|
LL | println!("val='{local_i32}'", local_i32 = local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("val='{local_i32}'", local_i32 = local_i32);
LL + println!("val='{local_i32}'");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:77:5
|
LL | println!("val='{local_i32}'", local_i32 = fn_arg);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("val='{local_i32}'", local_i32 = fn_arg);
LL + println!("val='{fn_arg}'");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:78:5
|
LL | println!("{0}", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{0}", local_i32);
LL + println!("{local_i32}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:79:5
|
LL | println!("{0:?}", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{0:?}", local_i32);
LL + println!("{local_i32:?}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:80:5
|
LL | println!("{0:#?}", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{0:#?}", local_i32);
LL + println!("{local_i32:#?}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:81:5
|
LL | println!("{0:04}", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{0:04}", local_i32);
LL + println!("{local_i32:04}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:82:5
|
LL | println!("{0:<3}", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{0:<3}", local_i32);
LL + println!("{local_i32:<3}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:83:5
|
LL | println!("{0:#010x}", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{0:#010x}", local_i32);
LL + println!("{local_i32:#010x}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:84:5
|
LL | println!("{0:.1}", local_f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{0:.1}", local_f64);
LL + println!("{local_f64:.1}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:85:5
|
LL | println!("{0} {0}", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{0} {0}", local_i32);
LL + println!("{local_i32} {local_i32}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:86:5
|
LL | println!("{1} {} {0} {}", local_i32, local_f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{1} {} {0} {}", local_i32, local_f64);
LL + println!("{local_f64} {local_i32} {local_i32} {local_f64}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:87:5
|
LL | println!("{0} {1}", local_i32, local_f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{0} {1}", local_i32, local_f64);
LL + println!("{local_i32} {local_f64}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:88:5
|
LL | println!("{1} {0}", local_i32, local_f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{1} {0}", local_i32, local_f64);
LL + println!("{local_f64} {local_i32}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:89:5
|
LL | println!("{1} {0} {1} {0}", local_i32, local_f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{1} {0} {1} {0}", local_i32, local_f64);
LL + println!("{local_f64} {local_i32} {local_f64} {local_i32}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:91:5
|
LL | println!("{v}", v = local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{v}", v = local_i32);
LL + println!("{local_i32}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:92:5
|
LL | println!("{local_i32:0$}", width);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{local_i32:0$}", width);
LL + println!("{local_i32:width$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:93:5
|
LL | println!("{local_i32:w$}", w = width);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{local_i32:w$}", w = width);
LL + println!("{local_i32:width$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:94:5
|
LL | println!("{local_i32:.0$}", prec);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{local_i32:.0$}", prec);
LL + println!("{local_i32:.prec$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:95:5
|
LL | println!("{local_i32:.p$}", p = prec);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{local_i32:.p$}", p = prec);
LL + println!("{local_i32:.prec$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:96:5
|
LL | println!("{:0$}", v = val);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:0$}", v = val);
LL + println!("{val:val$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:97:5
|
LL | println!("{0:0$}", v = val);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{0:0$}", v = val);
LL + println!("{val:val$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:98:5
|
LL | println!("{:0$.0$}", v = val);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:0$.0$}", v = val);
LL + println!("{val:val$.val$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:99:5
|
LL | println!("{0:0$.0$}", v = val);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{0:0$.0$}", v = val);
LL + println!("{val:val$.val$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:100:5
|
LL | println!("{0:0$.v$}", v = val);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{0:0$.v$}", v = val);
LL + println!("{val:val$.val$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:101:5
|
LL | println!("{0:v$.0$}", v = val);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{0:v$.0$}", v = val);
LL + println!("{val:val$.val$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:102:5
|
LL | println!("{v:0$.0$}", v = val);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{v:0$.0$}", v = val);
LL + println!("{val:val$.val$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:103:5
|
LL | println!("{v:v$.0$}", v = val);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{v:v$.0$}", v = val);
LL + println!("{val:val$.val$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:104:5
|
LL | println!("{v:0$.v$}", v = val);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{v:0$.v$}", v = val);
LL + println!("{val:val$.val$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:105:5
|
LL | println!("{v:v$.v$}", v = val);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{v:v$.v$}", v = val);
LL + println!("{val:val$.val$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:106:5
|
LL | println!("{:0$}", width);
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:0$}", width);
LL + println!("{width:width$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:107:5
|
LL | println!("{:1$}", local_i32, width);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:1$}", local_i32, width);
LL + println!("{local_i32:width$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:108:5
|
LL | println!("{:w$}", w = width);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:w$}", w = width);
LL + println!("{width:width$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:109:5
|
LL | println!("{:w$}", local_i32, w = width);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:w$}", local_i32, w = width);
LL + println!("{local_i32:width$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:110:5
|
LL | println!("{:.0$}", prec);
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:.0$}", prec);
LL + println!("{prec:.prec$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:111:5
|
LL | println!("{:.1$}", local_i32, prec);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:.1$}", local_i32, prec);
LL + println!("{local_i32:.prec$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:112:5
|
LL | println!("{:.p$}", p = prec);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:.p$}", p = prec);
LL + println!("{prec:.prec$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:113:5
|
LL | println!("{:.p$}", local_i32, p = prec);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:.p$}", local_i32, p = prec);
LL + println!("{local_i32:.prec$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:114:5
|
LL | println!("{:0$.1$}", width, prec);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:0$.1$}", width, prec);
LL + println!("{width:width$.prec$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:115:5
|
LL | println!("{:0$.w$}", width, w = prec);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:0$.w$}", width, w = prec);
LL + println!("{width:width$.prec$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:116:5
|
LL | println!("{:1$.2$}", local_f64, width, prec);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:1$.2$}", local_f64, width, prec);
LL + println!("{local_f64:width$.prec$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:117:5
|
LL | println!("{:1$.2$} {0} {1} {2}", local_f64, width, prec);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:1$.2$} {0} {1} {2}", local_f64, width, prec);
LL + println!("{local_f64:width$.prec$} {local_f64} {width} {prec}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:118:5
|
LL | / println!(
LL | | "{0:1$.2$} {0:2$.1$} {1:0$.2$} {1:2$.0$} {2:0$.1$} {2:1$.0$}",
LL | | local_i32, width, prec,
LL | | );
| |_____^
|
help: change this to
|
LL ~ "{local_i32:width$.prec$} {local_i32:prec$.width$} {width:local_i32$.prec$} {width:prec$.local_i32$} {prec:local_i32$.width$} {prec:width$.local_i32$}", width, prec,
LL ~ "{0:1$.2$} {0:2$.1$} {1:0$.2$} {1:2$.0$} {2:0$.1$} {2:1$.0$}", width, prec,
LL ~ "{0:1$.2$} {0:2$.1$} {1:0$.2$} {1:2$.0$} {2:0$.1$} {2:1$.0$}", width, prec,
LL ~ "{0:1$.2$} {0:2$.1$} {1:0$.2$} {1:2$.0$} {2:0$.1$} {2:1$.0$}", width, prec,
LL ~ "{0:1$.2$} {0:2$.1$} {1:0$.2$} {1:2$.0$} {2:0$.1$} {2:1$.0$}", width, prec,
LL ~ "{0:1$.2$} {0:2$.1$} {1:0$.2$} {1:2$.0$} {2:0$.1$} {2:1$.0$}",
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:129:5
|
LL | println!("Width = {}, value with width = {:0$}", local_i32, local_f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("Width = {}, value with width = {:0$}", local_i32, local_f64);
LL + println!("Width = {local_i32}, value with width = {local_f64:local_i32$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:130:5
|
LL | println!("{:w$.p$}", local_i32, w = width, p = prec);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:w$.p$}", local_i32, w = width, p = prec);
LL + println!("{local_i32:width$.prec$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:131:5
|
LL | println!("{:w$.p$}", w = width, p = prec);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{:w$.p$}", w = width, p = prec);
LL + println!("{width:width$.prec$}");
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:132:20
|
LL | println!("{}", format!("{}", local_i32));
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("{}", format!("{}", local_i32));
LL + println!("{}", format!("{local_i32}"));
|
error: variables can be used directly in the `format!` string
--> $DIR/uninlined_format_args.rs:170:5
|
LL | println!("expand='{}'", local_i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: change this to
|
LL - println!("expand='{}'", local_i32);
LL + println!("expand='{local_i32}'");
|
error: aborting due to 71 previous errors