@@ -20,7 +20,7 @@ use std::fmt;
20
20
use std:: io;
21
21
22
22
// PositiveNonzeroInteger is a struct defined below the tests.
23
- fn read_and_validate ( b : & mut io:: BufRead ) -> Result < PositiveNonzeroInteger , ???> {
23
+ fn read_and_validate ( b : & mut dyn io:: BufRead ) -> Result < PositiveNonzeroInteger , ???> {
24
24
let mut line = String :: new ( ) ;
25
25
b. read_line ( & mut line) ;
26
26
let num: i64 = line. trim ( ) . parse ( ) ;
@@ -29,7 +29,7 @@ fn read_and_validate(b: &mut io::BufRead) -> Result<PositiveNonzeroInteger, ???>
29
29
}
30
30
31
31
// This is a test helper function that turns a &str into a BufReader.
32
- fn test_with_str ( s : & str ) -> Result < PositiveNonzeroInteger , Box < error:: Error > > {
32
+ fn test_with_str ( s : & str ) -> Result < PositiveNonzeroInteger , Box < dyn error:: Error > > {
33
33
let mut b = io:: BufReader :: new ( s. as_bytes ( ) ) ;
34
34
read_and_validate ( & mut b)
35
35
}
@@ -98,7 +98,7 @@ enum CreationError {
98
98
99
99
impl fmt:: Display for CreationError {
100
100
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
101
- f. write_str ( ( self as & error:: Error ) . description ( ) )
101
+ f. write_str ( ( self as & dyn error:: Error ) . description ( ) )
102
102
}
103
103
}
104
104
@@ -190,7 +190,7 @@ impl error::Error for CreationError {
190
190
191
191
192
192
// Another hint: under the hood, the `?` operator calls `From::from`
193
- // on the error value to convert it to a boxed trait object, a Box<error::Error>,
193
+ // on the error value to convert it to a boxed trait object, a Box<dyn error::Error>,
194
194
// which is polymorphic-- that means that lots of different kinds of errors
195
195
// can be returned from the same function because all errors act the same
196
196
// since they all implement the `error::Error` trait.
0 commit comments