mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 04:50:36 +00:00
Fix clippy lints
This commit is contained in:
parent
7bc13ec66b
commit
4f9d2f44e1
6 changed files with 17 additions and 15 deletions
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
@ -2,6 +2,7 @@
|
|||
"luau-lsp.types.roblox": false,
|
||||
"luau-lsp.types.definitionFiles": ["luneTypes.d.luau"],
|
||||
"luau-lsp.sourcemap.enabled": false,
|
||||
"rust-analyzer.check.command": "clippy",
|
||||
"editor.formatOnSave": true,
|
||||
"stylua.searchParentDirectories": true,
|
||||
"prettier.tabWidth": 2,
|
||||
|
|
|
@ -25,9 +25,9 @@ impl UserData for LuneFs {
|
|||
}
|
||||
|
||||
async fn fs_read_file(_: &Lua, path: String) -> Result<String> {
|
||||
Ok(fs::read_to_string(&path)
|
||||
fs::read_to_string(&path)
|
||||
.await
|
||||
.map_err(mlua::Error::external)?)
|
||||
.map_err(mlua::Error::external)
|
||||
}
|
||||
|
||||
async fn fs_read_dir(_: &Lua, path: String) -> Result<Vec<String>> {
|
||||
|
@ -61,27 +61,25 @@ async fn fs_read_dir(_: &Lua, path: String) -> Result<Vec<String>> {
|
|||
}
|
||||
|
||||
async fn fs_write_file(_: &Lua, (path, contents): (String, String)) -> Result<()> {
|
||||
Ok(fs::write(&path, &contents)
|
||||
fs::write(&path, &contents)
|
||||
.await
|
||||
.map_err(mlua::Error::external)?)
|
||||
.map_err(mlua::Error::external)
|
||||
}
|
||||
|
||||
async fn fs_write_dir(_: &Lua, path: String) -> Result<()> {
|
||||
Ok(fs::create_dir_all(&path)
|
||||
fs::create_dir_all(&path)
|
||||
.await
|
||||
.map_err(mlua::Error::external)?)
|
||||
.map_err(mlua::Error::external)
|
||||
}
|
||||
|
||||
async fn fs_remove_file(_: &Lua, path: String) -> Result<()> {
|
||||
Ok(fs::remove_file(&path)
|
||||
.await
|
||||
.map_err(mlua::Error::external)?)
|
||||
fs::remove_file(&path).await.map_err(mlua::Error::external)
|
||||
}
|
||||
|
||||
async fn fs_remove_dir(_: &Lua, path: String) -> Result<()> {
|
||||
Ok(fs::remove_dir_all(&path)
|
||||
fs::remove_dir_all(&path)
|
||||
.await
|
||||
.map_err(mlua::Error::external)?)
|
||||
.map_err(mlua::Error::external)
|
||||
}
|
||||
|
||||
async fn fs_is_file(_: &Lua, path: String) -> Result<bool> {
|
||||
|
|
|
@ -24,5 +24,5 @@ fn json_encode(_: &Lua, (val, pretty): (Value, Option<bool>)) -> Result<String>
|
|||
}
|
||||
|
||||
fn json_decode(lua: &Lua, json: String) -> Result<Value> {
|
||||
Ok(lua.to_value(&json)?)
|
||||
lua.to_value(&json)
|
||||
}
|
||||
|
|
|
@ -44,7 +44,8 @@ fn process_get_env_var(lua: &Lua, key: String) -> Result<Value> {
|
|||
}
|
||||
|
||||
fn process_set_env_var(_: &Lua, (key, value): (String, String)) -> Result<()> {
|
||||
Ok(env::set_var(&key, &value))
|
||||
env::set_var(key, value);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn process_exit(_: &Lua, exit_code: Option<i32>) -> Result<()> {
|
||||
|
@ -78,7 +79,7 @@ async fn process_spawn(lua: &Lua, (program, args): (String, Option<Vec<String>>)
|
|||
let code = output
|
||||
.status
|
||||
.code()
|
||||
.unwrap_or_else(|| match output.stderr.is_empty() {
|
||||
.unwrap_or(match output.stderr.is_empty() {
|
||||
true => 0,
|
||||
false => 1,
|
||||
});
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![deny(clippy::all, clippy::cargo)]
|
||||
|
||||
use clap::Parser;
|
||||
use mlua::Result;
|
||||
|
||||
|
|
|
@ -28,6 +28,6 @@ pub fn pretty_print_luau_error(e: &mlua::Error) {
|
|||
from, to, msg
|
||||
)
|
||||
}
|
||||
e => eprintln!("{}", e.to_string()),
|
||||
e => eprintln!("{e}"),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue