From 273de37790e8a5fc8e662fbc220eb670084a65c3 Mon Sep 17 00:00:00 2001 From: Julio Merino Date: Wed, 25 Jul 2018 06:15:34 -0400 Subject: [PATCH] Remove mountpoint reference from {,spawn_}mount() The mount() and spawn_mount() calls define mountpoint as a &P but P is already an AsRef. This prevents passing the mountpoint to these calls when it is already a reference without having to take an additional reference to it. For example: fn foo(mountpoint: &Path) { fuse::mount(..., mountpoint, ...); ... } does not compile without passing mountpoint as &mountpoint to the fuse::mount() call, but there is no reason that it should not. To fix this, remove the extra reference reference qualifier. --- examples/hello.rs | 2 +- examples/null.rs | 2 +- src/lib.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/hello.rs b/examples/hello.rs index e84c1bd..f42ee9d 100644 --- a/examples/hello.rs +++ b/examples/hello.rs @@ -97,5 +97,5 @@ fn main() { .iter() .map(|o| o.as_ref()) .collect::>(); - fuse::mount(HelloFS, &mountpoint, &options).unwrap(); + fuse::mount(HelloFS, mountpoint, &options).unwrap(); } diff --git a/examples/null.rs b/examples/null.rs index efce27a..591809f 100644 --- a/examples/null.rs +++ b/examples/null.rs @@ -11,5 +11,5 @@ impl Filesystem for NullFS {} fn main() { env_logger::init(); let mountpoint = env::args_os().nth(1).unwrap(); - fuse::mount(NullFS, &mountpoint, &[]).unwrap(); + fuse::mount(NullFS, mountpoint, &[]).unwrap(); } diff --git a/src/lib.rs b/src/lib.rs index e3e38cd..0028631 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -375,7 +375,7 @@ pub trait Filesystem { /// /// Note that you need to lead each option with a separate `"-o"` string. See /// `examples/hello.rs`. -pub fn mount>(filesystem: FS, mountpoint: &P, options: &[&OsStr]) -> io::Result<()>{ +pub fn mount>(filesystem: FS, mountpoint: P, options: &[&OsStr]) -> io::Result<()>{ Session::new(filesystem, mountpoint.as_ref(), options).and_then(|mut se| se.run()) } @@ -384,6 +384,6 @@ pub fn mount>(filesystem: FS, mountpoint: &P, opt /// and therefore returns immediately. The returned handle should be stored /// to reference the mounted filesystem. If it's dropped, the filesystem will /// be unmounted. -pub unsafe fn spawn_mount<'a, FS: Filesystem+Send+'a, P: AsRef>(filesystem: FS, mountpoint: &P, options: &[&OsStr]) -> io::Result> { +pub unsafe fn spawn_mount<'a, FS: Filesystem+Send+'a, P: AsRef>(filesystem: FS, mountpoint: P, options: &[&OsStr]) -> io::Result> { Session::new(filesystem, mountpoint.as_ref(), options).and_then(|se| se.spawn()) }