fix: clippy

This commit is contained in:
Miles Murgaw committed 2023-06-30 10:48:38 -04:00
1 parent 4ab8519af6
commit 2c8c601579
13 files changed
+54 -54

No files matched your search

+2 -1
View File
@@ -2,6 +2,7 @@ use std::process::{Command, Stdio};
use mlua::{FromLua, UserData};
#[derive(Debug, Clone, Copy)]
enum StdioFromString {
Inherit,
Piped,
@@ -41,7 +42,7 @@ impl UserData for PluginCommander {
let stdout = args.1;
let stderr = args.2;
if cmd.len() == 0 {
if cmd.is_empty() {
return Ok(());
}
let cmd_name = cmd.get(0).unwrap();
+1 -1
View File
@@ -58,7 +58,7 @@ impl UserData for PluginFileSystem {
let file = PathBuf::from(args.0);
let target = PathBuf::from(args.1);
let res = extract_zip(&file, &target);
if let Err(_) = res {
if res.is_err() {
return Ok(false);
}
Ok(true)
+4 -3
View File
@@ -18,10 +18,11 @@ impl UserData for PluginPath {
methods.add_function("parent", |_, path: String| {
let current_path = PathBuf::from(&path);
let parent = current_path.parent();
if parent.is_none() {
return Ok(path);
if let Some(parent) = parent {
Ok(parent.to_str().unwrap().to_string())
} else {
return Ok(parent.unwrap().to_str().unwrap().to_string());
Ok(path)
}
});
methods.add_function("exists", |_, path: String| {