summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--copypasta/src/macos.rs5
-rw-r--r--copypasta/src/x11.rs12
-rw-r--r--font/src/ft/list_fonts.rs4
3 files changed, 11 insertions, 10 deletions
diff --git a/copypasta/src/macos.rs b/copypasta/src/macos.rs
index 4910790d..dfbf5a87 100644
--- a/copypasta/src/macos.rs
+++ b/copypasta/src/macos.rs
@@ -222,11 +222,12 @@ impl super::Load for Clipboard {
type Err = 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> {
- Ok(try!(self::ns::PasteboardReadObject::<String>::read_object(&self.0)))
+ self::ns::PasteboardReadObject::<String>::read_object(&self.0)
+ .map_err(::std::convert::From::from)
}
}
diff --git a/copypasta/src/x11.rs b/copypasta/src/x11.rs
index 45fa4825..8d88c79e 100644
--- a/copypasta/src/x11.rs
+++ b/copypasta/src/x11.rs
@@ -71,17 +71,17 @@ impl Load for Clipboard {
}
fn load_primary(&self) -> Result<String, Self::Err> {
- let output = try!(Command::new("xclip")
+ let output = Command::new("xclip")
.args(&["-o", "-selection", "clipboard"])
- .output());
+ .output()?;
Clipboard::process_xclip_output(output)
}
fn load_selection(&self) -> Result<String, Self::Err> {
- let output = try!(Command::new("xclip")
+ let output = Command::new("xclip")
.args(&["-o"])
- .output());
+ .output()?;
Clipboard::process_xclip_output(output)
}
@@ -90,9 +90,9 @@ impl Load for Clipboard {
impl Clipboard {
fn process_xclip_output(output: Output) -> Result<String, Error> {
if output.status.success() {
- Ok(try!(String::from_utf8(output.stdout)))
+ String::from_utf8(output.stdout).map_err(::std::convert::From::from)
} else {
- Ok(try!(String::from_utf8(output.stderr)))
+ String::from_utf8(output.stderr).map_err(::std::convert::From::from)
}
}
}
diff --git a/font/src/ft/list_fonts.rs b/font/src/ft/list_fonts.rs
index c9eccec7..1dc716d5 100644
--- a/font/src/ft/list_fonts.rs
+++ b/font/src/ft/list_fonts.rs
@@ -105,9 +105,9 @@ pub struct Family {
impl fmt::Display for Family {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- try!(write!(f, "{}: ", self.name));
+ write!(f, "{}: ", self.name)?;
for (k, _v) in &self.variants {
- try!(write!(f, "{}, ", k));
+ write!(f, "{}, ", k)?;
}
Ok(())