Skip to content

Commit 78b9eb0

Browse files
authored
Merge pull request #20 from alarsyo/deprecated-description
Fix deprecated Error::description
2 parents 9f27a61 + c675996 commit 78b9eb0

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/lib.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,13 +296,7 @@ pub enum LoadError {
296296

297297
impl fmt::Display for LoadError {
298298
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
299-
f.write_str(self.description())
300-
}
301-
}
302-
303-
impl Error for LoadError {
304-
fn description(&self) -> &str {
305-
match *self {
299+
let msg = match *self {
306300
LoadError::OpenFileFailed => "open file failed",
307301
LoadError::ReadError => "read error",
308302
LoadError::UnrecognizedCharacter => "unrecognized character",
@@ -313,10 +307,13 @@ impl Error for LoadError {
313307
LoadError::MaterialParseError => "material parse error",
314308
LoadError::InvalidObjectName => "invalid object name",
315309
LoadError::GenericFailure => "generic failure",
316-
}
310+
};
311+
312+
f.write_str(msg)
317313
}
318314
}
319315

316+
impl Error for LoadError {}
320317

321318
/// `LoadResult` is a result containing all the models loaded from the file and any materials from
322319
/// referenced material libraries, or an error that occured while loading

0 commit comments

Comments
 (0)