mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
add a test against #100898
This commit is contained in:
parent
cf1d3d0370
commit
d23dce54ec
3 changed files with 27 additions and 1 deletions
|
@ -54,4 +54,14 @@ impl Read for ImplementsDefault {
|
|||
|
||||
fn issue_9621_dyn_trait() {
|
||||
let _: Box<dyn Read> = Box::<ImplementsDefault>::default();
|
||||
issue_10089();
|
||||
}
|
||||
|
||||
fn issue_10089() {
|
||||
let _closure = || {
|
||||
#[derive(Default)]
|
||||
struct WeirdPathed;
|
||||
|
||||
let _ = Box::<WeirdPathed>::default();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -54,4 +54,14 @@ impl Read for ImplementsDefault {
|
|||
|
||||
fn issue_9621_dyn_trait() {
|
||||
let _: Box<dyn Read> = Box::new(ImplementsDefault::default());
|
||||
issue_10089();
|
||||
}
|
||||
|
||||
fn issue_10089() {
|
||||
let _closure = || {
|
||||
#[derive(Default)]
|
||||
struct WeirdPathed;
|
||||
|
||||
let _ = Box::new(WeirdPathed::default());
|
||||
};
|
||||
}
|
||||
|
|
|
@ -84,5 +84,11 @@ error: `Box::new(_)` of default value
|
|||
LL | let _: Box<dyn Read> = Box::new(ImplementsDefault::default());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<ImplementsDefault>::default()`
|
||||
|
||||
error: aborting due to 14 previous errors
|
||||
error: `Box::new(_)` of default value
|
||||
--> $DIR/box_default.rs:65:17
|
||||
|
|
||||
LL | let _ = Box::new(WeirdPathed::default());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Box::<WeirdPathed>::default()`
|
||||
|
||||
error: aborting due to 15 previous errors
|
||||
|
||||
|
|
Loading…
Reference in a new issue