remove use of deprecated item 'try': use the ? operator instead

Signed-off-by: Nikola Pajkovsky <nikola.pajkovsky@livesporttv.cz>
This commit is contained in:
Nikola Pajkovsky
2020-05-21 12:11:15 +02:00
parent 415ad30bd0
commit 51b2cac594
5 changed files with 33 additions and 34 deletions

View File

@ -75,7 +75,7 @@ impl MagickWand {
angle: f64,
text: &str,
) -> Result<(), &'static str> {
let c_string = try!(CString::new(text).map_err(|_| "could not convert to cstring"));
let c_string = CString::new(text).map_err(|_| "could not convert to cstring")?;
match unsafe {
bindings::MagickAnnotateImage(
self.wand,
@ -841,11 +841,11 @@ impl MagickWand {
impl fmt::Debug for MagickWand {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(writeln!(f, "MagickWand {{"));
try!(writeln!(f, " Exception: {:?}", self.get_exception()));
try!(writeln!(f, " IsWand: {:?}", self.is_wand()));
try!(self.fmt_string_settings(f, " "));
try!(self.fmt_checked_settings(f, " "));
writeln!(f, "MagickWand {{")?;
writeln!(f, " Exception: {:?}", self.get_exception())?;
writeln!(f, " IsWand: {:?}", self.is_wand())?;
self.fmt_string_settings(f, " ")?;
self.fmt_checked_settings(f, " ")?;
writeln!(f, "}}")
}
}