summaryrefslogtreecommitdiff
path: root/src/sys/quota.rs
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2018-12-08 13:47:33 -0700
committerAlan Somers <asomers@gmail.com>2018-12-08 13:51:43 -0700
commitca035734df2e3dfeb866cbfee51de7b582be83f5 (patch)
treedbbf94ee5189b13ea4d448ba63512b43f85b4ba8 /src/sys/quota.rs
parent5a3ac8df3fa2de86477d961d8b5720b1d283b2d5 (diff)
downloadnix-ca035734df2e3dfeb866cbfee51de7b582be83f5.zip
Replace try! with ?
try! is not available in Rust 2018
Diffstat (limited to 'src/sys/quota.rs')
-rw-r--r--src/sys/quota.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/sys/quota.rs b/src/sys/quota.rs
index b4cac1dc..14c04629 100644
--- a/src/sys/quota.rs
+++ b/src/sys/quota.rs
@@ -231,12 +231,10 @@ impl Dqblk {
fn quotactl<P: ?Sized + NixPath>(cmd: QuotaCmd, special: Option<&P>, id: c_int, addr: *mut c_char) -> Result<()> {
unsafe {
Errno::clear();
- let res = try!(
- match special {
- Some(dev) => dev.with_nix_path(|path| libc::quotactl(cmd.as_int(), path.as_ptr(), id, addr)),
- None => Ok(libc::quotactl(cmd.as_int(), ptr::null(), id, addr)),
- }
- );
+ let res = match special {
+ Some(dev) => dev.with_nix_path(|path| libc::quotactl(cmd.as_int(), path.as_ptr(), id, addr)),
+ None => Ok(libc::quotactl(cmd.as_int(), ptr::null(), id, addr)),
+ }?;
Errno::result(res).map(drop)
}
@@ -244,11 +242,11 @@ fn quotactl<P: ?Sized + NixPath>(cmd: QuotaCmd, special: Option<&P>, id: c_int,
/// Turn on disk quotas for a block device.
pub fn quotactl_on<P: ?Sized + NixPath>(which: QuotaType, special: &P, format: QuotaFmt, quota_file: &P) -> Result<()> {
- try!(quota_file.with_nix_path(|path| {
+ quota_file.with_nix_path(|path| {
let mut path_copy = path.to_bytes_with_nul().to_owned();
let p: *mut c_char = path_copy.as_mut_ptr() as *mut c_char;
quotactl(QuotaCmd(QuotaSubCmd::Q_QUOTAON, which), Some(special), format as c_int, p)
- }))
+ })?
}
/// Disable disk quotas for a block device.