rust: Fix deprecation warnings
This commit is contained in:
		@ -737,8 +737,7 @@ fn create_button<H: logging::Handler>(
 | 
			
		||||
#[cfg(test)]
 | 
			
		||||
mod tests {
 | 
			
		||||
    use super::*;
 | 
			
		||||
    
 | 
			
		||||
    use std::error::Error as ErrorTrait;
 | 
			
		||||
 | 
			
		||||
    use ::logging::ProblemPanic;
 | 
			
		||||
 | 
			
		||||
    const THIS_FILE: &str = file!();
 | 
			
		||||
@ -786,7 +785,8 @@ mod tests {
 | 
			
		||||
            Err(e) => {
 | 
			
		||||
                let mut handled = false;
 | 
			
		||||
                if let Error::Yaml(ye) = &e {
 | 
			
		||||
                    handled = ye.description() == "missing field `views`";
 | 
			
		||||
                    handled = ye.to_string()
 | 
			
		||||
                        .starts_with("missing field `views`");
 | 
			
		||||
                };
 | 
			
		||||
                if !handled {
 | 
			
		||||
                    println!("Unexpected error {:?}", e);
 | 
			
		||||
@ -804,7 +804,7 @@ mod tests {
 | 
			
		||||
            Err(e) => {
 | 
			
		||||
                let mut handled = false;
 | 
			
		||||
                if let Error::Yaml(ye) = &e {
 | 
			
		||||
                    handled = ye.description()
 | 
			
		||||
                    handled = ye.to_string()
 | 
			
		||||
                        .starts_with("unknown field `bad_field`");
 | 
			
		||||
                };
 | 
			
		||||
                if !handled {
 | 
			
		||||
 | 
			
		||||
@ -31,22 +31,16 @@ pub enum Error {
 | 
			
		||||
 | 
			
		||||
impl ::std::fmt::Display for Error {
 | 
			
		||||
    fn fmt(&self, out: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
 | 
			
		||||
        use ::std::error::Error;
 | 
			
		||||
        out.write_str(self.description())
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl ::std::error::Error for Error {
 | 
			
		||||
    fn description(&self) -> &str {
 | 
			
		||||
        match self {
 | 
			
		||||
        out.write_str(match self {
 | 
			
		||||
            &Error::NotWellFormed => "Language tag is not well-formed.",
 | 
			
		||||
            // this is exception: here we do want exhaustive match so we don't publish version with
 | 
			
		||||
            // missing descriptions by mistake.
 | 
			
		||||
            &Error::__NonExhaustive => panic!("Placeholder error must not be instantiated!"),
 | 
			
		||||
        }
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/// Convenience Result alias.
 | 
			
		||||
type Result<T> = ::std::result::Result<T, Error>;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user