@@ -154,40 +154,40 @@ impl fmt::Display for E {
154
154
impl error:: Error for E { }
155
155
156
156
#[ test]
157
- fn test_try_downcast_inner ( ) {
157
+ fn test_std_io_error_downcast ( ) {
158
158
// Case 1: custom error, downcast succeeds
159
159
let io_error = Error :: new ( ErrorKind :: Other , Bojji ( true ) ) ;
160
- let e: Box < Bojji > = io_error. try_downcast_inner ( ) . unwrap ( ) ;
160
+ let e: Box < Bojji > = io_error. downcast ( ) . unwrap ( ) ;
161
161
assert ! ( e. 0 ) ;
162
162
163
163
// Case 2: custom error, downcast fails
164
164
let io_error = Error :: new ( ErrorKind :: Other , Bojji ( true ) ) ;
165
- let io_error = io_error. try_downcast_inner :: < E > ( ) . unwrap_err ( ) ;
165
+ let io_error = io_error. downcast :: < E > ( ) . unwrap_err ( ) ;
166
166
167
167
// ensures that the custom error is intact
168
168
assert_eq ! ( ErrorKind :: Other , io_error. kind( ) ) ;
169
- let e: Box < Bojji > = io_error. try_downcast_inner ( ) . unwrap ( ) ;
169
+ let e: Box < Bojji > = io_error. downcast ( ) . unwrap ( ) ;
170
170
assert ! ( e. 0 ) ;
171
171
172
172
// Case 3: os error
173
173
let errno = 20 ;
174
174
let io_error = Error :: from_raw_os_error ( errno) ;
175
- let io_error = io_error. try_downcast_inner :: < E > ( ) . unwrap_err ( ) ;
175
+ let io_error = io_error. downcast :: < E > ( ) . unwrap_err ( ) ;
176
176
177
177
assert_eq ! ( errno, io_error. raw_os_error( ) . unwrap( ) ) ;
178
178
179
179
// Case 4: simple
180
180
let kind = ErrorKind :: OutOfMemory ;
181
181
let io_error: Error = kind. into ( ) ;
182
- let io_error = io_error. try_downcast_inner :: < E > ( ) . unwrap_err ( ) ;
182
+ let io_error = io_error. downcast :: < E > ( ) . unwrap_err ( ) ;
183
183
184
184
assert_eq ! ( kind, io_error. kind( ) ) ;
185
185
186
186
// Case 5: simple message
187
187
const SIMPLE_MESSAGE : SimpleMessage =
188
188
SimpleMessage { kind : ErrorKind :: Other , message : "simple message error test" } ;
189
189
let io_error = Error :: from_static_message ( & SIMPLE_MESSAGE ) ;
190
- let io_error = io_error. try_downcast_inner :: < E > ( ) . unwrap_err ( ) ;
190
+ let io_error = io_error. downcast :: < E > ( ) . unwrap_err ( ) ;
191
191
192
192
assert_eq ! ( SIMPLE_MESSAGE . kind, io_error. kind( ) ) ;
193
193
assert_eq ! ( SIMPLE_MESSAGE . message, & * format!( "{io_error}" ) ) ;
0 commit comments