Skip to content

Conversation

@alarsyo
Copy link
Contributor

@alarsyo alarsyo commented Mar 26, 2020

Deprecated since Rust 1.42.

Currently any user that calls error.description() will get a deprecation warning, but this won't prevent their code from compiling: Error has a default implementation for description() (although the text won't be correct now, obviously).

If you want users that relied on this to still get the right text, I can instead add a function

impl LoadError {
    fn msg() -> &str {
        match *self {
            LoadError::OpenFileFailed => "open file failed",
            LoadError::ReadError => "read error",
            LoadError::UnrecognizedCharacter => "unrecognized character",
            LoadError::PositionParseError => "position parse error",
            LoadError::NormalParseError => "normal parse error",
            LoadError::TexcoordParseError => "texcoord parse error",
            LoadError::FaceParseError => "face parse error",
            LoadError::MaterialParseError => "material parse error",
            LoadError::InvalidObjectName => "invalid object name",
            LoadError::GenericFailure => "generic failure",
        }
    }
}

and then use that in both description() and the Display impl.

@Twinklebear
Copy link
Owner

We can just take this in as a breaking change since the old way is being deprecated anyways. Thanks @alarsyo !

@Twinklebear Twinklebear merged commit 78b9eb0 into Twinklebear:master Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants