You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the message should suggest the .as_ref() method at the call site.
Reproducer
Clippy reported this:
warning: you seem to be trying to use `&Box<T>`.Consider using just `&T`
--> advent2023-bin/src/main.rs:46:54
|
46 | let get_result_pair = move |day_num:usize,day:&Box<dynDayTrait>| -> (String,String){
| ^^^^^^^^^^^^^^^^^^ help:try: `&dynDayTrait`
|
= help:for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrowed_box
= note: `#[warn(clippy::borrowed_box)]` on by default
When fixed as indicated:
error[E0277]: the trait bound `Box<dyn DayTrait>:DayTrait` is not satisfied
--> advent2023-bin/src/main.rs:63:76
|
63 | print_day(day_num, day.get_display(),get_result_pair(day_num,&day));
| ^^^^ the trait `DayTrait` is not implemented for `Box<dynDayTrait>`
|
= help: the trait `DayTrait` is implemented for `Day<D,O,C,F,S>`
= note: required for the cast from `&Box<dynDayTrait>` to `&dynDayTrait`
Summary
This follows from #3971
and #8161.
I think the message should suggest the
.as_ref()
method at the call site.Reproducer
Clippy reported this:
When fixed as indicated:
See minimum reproduction:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=88aa6d38369c9c8f48eabf5899ed65b0
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: