mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-25 14:05:41 -05:00
Replace remaining use of try!
with ?
This commit is contained in:
parent
dc918ae71a
commit
0421012c2d
3 changed files with 11 additions and 10 deletions
|
@ -222,11 +222,12 @@ impl super::Load for Clipboard {
|
||||||
type Err = Error;
|
type Err = Error;
|
||||||
|
|
||||||
fn new() -> Result<Self, Error> {
|
fn new() -> Result<Self, Error> {
|
||||||
Ok(Clipboard(try!(ns::Pasteboard::new())))
|
Ok(Clipboard(ns::Pasteboard::new()?))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_primary(&self) -> Result<String, Self::Err> {
|
fn load_primary(&self) -> Result<String, Self::Err> {
|
||||||
Ok(try!(self::ns::PasteboardReadObject::<String>::read_object(&self.0)))
|
self::ns::PasteboardReadObject::<String>::read_object(&self.0)
|
||||||
|
.map_err(::std::convert::From::from)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,17 +71,17 @@ impl Load for Clipboard {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_primary(&self) -> Result<String, Self::Err> {
|
fn load_primary(&self) -> Result<String, Self::Err> {
|
||||||
let output = try!(Command::new("xclip")
|
let output = Command::new("xclip")
|
||||||
.args(&["-o", "-selection", "clipboard"])
|
.args(&["-o", "-selection", "clipboard"])
|
||||||
.output());
|
.output()?;
|
||||||
|
|
||||||
Clipboard::process_xclip_output(output)
|
Clipboard::process_xclip_output(output)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_selection(&self) -> Result<String, Self::Err> {
|
fn load_selection(&self) -> Result<String, Self::Err> {
|
||||||
let output = try!(Command::new("xclip")
|
let output = Command::new("xclip")
|
||||||
.args(&["-o"])
|
.args(&["-o"])
|
||||||
.output());
|
.output()?;
|
||||||
|
|
||||||
Clipboard::process_xclip_output(output)
|
Clipboard::process_xclip_output(output)
|
||||||
}
|
}
|
||||||
|
@ -90,9 +90,9 @@ impl Load for Clipboard {
|
||||||
impl Clipboard {
|
impl Clipboard {
|
||||||
fn process_xclip_output(output: Output) -> Result<String, Error> {
|
fn process_xclip_output(output: Output) -> Result<String, Error> {
|
||||||
if output.status.success() {
|
if output.status.success() {
|
||||||
Ok(try!(String::from_utf8(output.stdout)))
|
String::from_utf8(output.stdout).map_err(::std::convert::From::from)
|
||||||
} else {
|
} else {
|
||||||
Ok(try!(String::from_utf8(output.stderr)))
|
String::from_utf8(output.stderr).map_err(::std::convert::From::from)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,9 +105,9 @@ pub struct Family {
|
||||||
|
|
||||||
impl fmt::Display for Family {
|
impl fmt::Display for Family {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
try!(write!(f, "{}: ", self.name));
|
write!(f, "{}: ", self.name)?;
|
||||||
for (k, _v) in &self.variants {
|
for (k, _v) in &self.variants {
|
||||||
try!(write!(f, "{}, ", k));
|
write!(f, "{}, ", k)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue