Skip to content

Commit

Permalink
Minor refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
aert committed Jul 12, 2019
1 parent 0429d3b commit 9c7363d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ mod platform;
#[path = "macos.rs"]
mod platform;

use platform::*;

#[derive(Debug)]
pub enum Error {
Unknown,
Expand All @@ -35,7 +33,7 @@ pub enum Error {
}

pub fn remove<T: AsRef<Path>>(path: T) -> Result<(), Error> {
platform_remove(path)
platform::remove(path)
}

pub fn is_implemented() -> bool {
Expand Down
2 changes: 1 addition & 1 deletion src/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn is_implemented() -> bool {

/// This is based on the electron library's implementation.
/// See: https://github.com/electron/electron/blob/34c4c8d5088fa183f56baea28809de6f2a427e02/shell/common/platform_util_linux.cc#L96
pub fn platform_remove<T: AsRef<Path>>(path: T) -> Result<(), Error> {
pub fn remove<T: AsRef<Path>>(path: T) -> Result<(), Error> {
static DEFAULT_TRASH: &str = "gio";

let full_path = path
Expand Down
2 changes: 1 addition & 1 deletion src/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ pub fn is_implemented() -> bool {
false
}

pub fn platform_remove<T: AsRef<Path>>(path: T) -> Result<(), Error> {
pub fn remove<T: AsRef<Path>>(path: T) -> Result<(), Error> {
unimplemented!();
}
2 changes: 1 addition & 1 deletion src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub fn is_implemented() -> bool {
}

/// See https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-_shfileopstructa
pub fn platform_remove<T: AsRef<Path>>(path: T) -> Result<(), Error> {
pub fn remove<T: AsRef<Path>>(path: T) -> Result<(), Error> {
let canonical = path
.as_ref()
.canonicalize()
Expand Down

0 comments on commit 9c7363d

Please sign in to comment.