summaryrefslogtreecommitdiff
path: root/src/mount.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-12-09 01:05:23 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-12-09 01:05:23 +0000
commitf1b12d6b1b8bf6d8ad41e7b2967b95c6f876745c (patch)
treedbbf94ee5189b13ea4d448ba63512b43f85b4ba8 /src/mount.rs
parent5a3ac8df3fa2de86477d961d8b5720b1d283b2d5 (diff)
parentca035734df2e3dfeb866cbfee51de7b582be83f5 (diff)
downloadnix-f1b12d6b1b8bf6d8ad41e7b2967b95c6f876745c.zip
Merge #995
995: Replace try! with ? r=asomers a=asomers try! is not available in Rust 2018. It would be premature to convert the entire project to Rust 2018, since that would bump the minimum compiler to 1.31.0. But his change will help us when we do convert it eventually. Co-authored-by: Alan Somers <asomers@gmail.com>
Diffstat (limited to 'src/mount.rs')
-rw-r--r--src/mount.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mount.rs b/src/mount.rs
index 8fe99513..72b719d7 100644
--- a/src/mount.rs
+++ b/src/mount.rs
@@ -63,7 +63,7 @@ pub fn mount<P1: ?Sized + NixPath, P2: ?Sized + NixPath, P3: ?Sized + NixPath, P
data: Option<&P4>) -> Result<()> {
use libc;
- let res = try!(try!(try!(try!(
+ let res =
source.with_nix_path(|source| {
target.with_nix_path(|target| {
fstype.with_nix_path(|fstype| {
@@ -78,23 +78,23 @@ pub fn mount<P1: ?Sized + NixPath, P2: ?Sized + NixPath, P3: ?Sized + NixPath, P
})
})
})
- })))));
+ })????;
Errno::result(res).map(drop)
}
pub fn umount<P: ?Sized + NixPath>(target: &P) -> Result<()> {
- let res = try!(target.with_nix_path(|cstr| {
+ let res = target.with_nix_path(|cstr| {
unsafe { libc::umount(cstr.as_ptr()) }
- }));
+ })?;
Errno::result(res).map(drop)
}
pub fn umount2<P: ?Sized + NixPath>(target: &P, flags: MntFlags) -> Result<()> {
- let res = try!(target.with_nix_path(|cstr| {
+ let res = target.with_nix_path(|cstr| {
unsafe { libc::umount2(cstr.as_ptr(), flags.bits) }
- }));
+ })?;
Errno::result(res).map(drop)
}