-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Closed
Description
Hi!
I've noticed, that the exercise:
/exercises/error_handling/errorsn.rs
is using a deprecated syntax for traits related values.
It causes the compiler to display warning messages:
rustlings run exercises/error_handling/errorsn.rs
! Compiling of exercises/error_handling/errorsn.rs failed! Please try again. Here's the output:
warning: trait objects without an explicit `dyn` are deprecated
--> exercises/error_handling/errorsn.rs:23:30
|
23 | fn read_and_validate(b: &mut io::BufRead) -> Result<PositiveNonzeroInteger, Box<error::Error>> {
| ^^^^^^^^^^^ help: use `dyn`: `dyn io::BufRead`
|
= note: #[warn(bare_trait_objects)] on by default
warning: trait objects without an explicit `dyn` are deprecated
--> exercises/error_handling/errorsn.rs:23:81
|
23 | fn read_and_validate(b: &mut io::BufRead) -> Result<PositiveNonzeroInteger, Box<error::Error>> {
| ^^^^^^^^^^^^ help: use `dyn`: `dyn error::Error`
warning: trait objects without an explicit `dyn` are deprecated
--> exercises/error_handling/errorsn.rs:32:65
|
32 | fn test_with_str(s: &str) -> Result<PositiveNonzeroInteger, Box<error::Error>> {
| ^^^^^^^^^^^^ help: use `dyn`: `dyn error::Error`
warning: trait objects without an explicit `dyn` are deprecated
--> exercises/error_handling/errorsn.rs:101:31
|
101 | f.write_str((self as &error::Error).description())
| ^^^^^^^^^^^^ help: use `dyn`: `dyn error::Error`
Probably the solution is as simple as changing Box<Trait>
to a recomended Box<dyn Trait>
(or maybe impl Trait
is better?
I will prepare a simple pull request with a fix.
I'm fairly new to Rust, so if what I'm saying does not make sense, just let me know ;)
rustc 1.37.0 (eae3437df 2019-08-13)
rustlings 1.4.1
Metadata
Metadata
Assignees
Labels
No labels