mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 13:43:17 +00:00
0f63fa8c33
`Box::default()` had its `#[rustc_box]` attribute removed in 1.69 so is no longer a perf related lint The lint is moved to style but no longer produces suggestions containing turbofishes, as they're often longer/more annoying to type
59 lines
2.2 KiB
Text
59 lines
2.2 KiB
Text
error: `Box::new(_)` of default value
|
|
--> tests/ui/box_default.rs:34:32
|
|
|
|
|
LL | let string1: Box<String> = Box::new(Default::default());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
|
|
|
|
|
= note: `-D clippy::box-default` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::box_default)]`
|
|
|
|
error: `Box::new(_)` of default value
|
|
--> tests/ui/box_default.rs:35:32
|
|
|
|
|
LL | let string2: Box<String> = Box::new(String::new());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
|
|
|
|
error: `Box::new(_)` of default value
|
|
--> tests/ui/box_default.rs:36:41
|
|
|
|
|
LL | let impl1: Box<ImplementsDefault> = Box::new(Default::default());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
|
|
|
|
error: `Box::new(_)` of default value
|
|
--> tests/ui/box_default.rs:37:29
|
|
|
|
|
LL | let vec: Box<Vec<u8>> = Box::new(Vec::new());
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
|
|
|
|
error: `Box::new(_)` of default value
|
|
--> tests/ui/box_default.rs:38:25
|
|
|
|
|
LL | let byte: Box<u8> = Box::new(u8::default());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
|
|
|
|
error: `Box::new(_)` of default value
|
|
--> tests/ui/box_default.rs:39:45
|
|
|
|
|
LL | let vec2: Box<Vec<ImplementsDefault>> = Box::new(vec![]);
|
|
| ^^^^^^^^^^^^^^^^ help: try: `Box::default()`
|
|
|
|
error: `Box::new(_)` of default value
|
|
--> tests/ui/box_default.rs:40:32
|
|
|
|
|
LL | let vec3: Box<Vec<bool>> = Box::new(Vec::from([]));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
|
|
|
|
error: `Box::new(_)` of default value
|
|
--> tests/ui/box_default.rs:42:25
|
|
|
|
|
LL | let plain_default = Box::new(Default::default());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
|
|
|
|
error: `Box::new(_)` of default value
|
|
--> tests/ui/box_default.rs:59:16
|
|
|
|
|
LL | call_ty_fn(Box::new(u8::default()));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::default()`
|
|
|
|
error: aborting due to 9 previous errors
|
|
|