Run clippy

main
trivernis 8 months ago
parent b034617e73
commit a97515ba03
Signed by: Trivernis
GPG Key ID: 7E6D18B61C8D2F4B

@ -43,5 +43,5 @@ fn default_repo() -> &'static str {
.to_string_lossy() .to_string_lossy()
.into(); .into();
} }
&*DEFAULT_REPO &DEFAULT_REPO
} }

@ -161,7 +161,7 @@ fn ensure_parent(parent: &Path) -> Result<(), miette::ErrReport> {
return Ok(()); return Ok(());
} }
log::info!("Creating {parent:?}"); log::info!("Creating {parent:?}");
fs::create_dir_all(&parent) fs::create_dir_all(parent)
.into_diagnostic() .into_diagnostic()
.with_context(|| format!("Creating directory {parent:?}")) .with_context(|| format!("Creating directory {parent:?}"))
} }

@ -20,7 +20,7 @@ fn main() -> Result<()> {
init_logging(args.verbose); init_logging(args.verbose);
match &args.command { match &args.command {
args::Command::Init(init_args) => init(&args, &init_args)?, args::Command::Init(init_args) => init(&args, init_args)?,
args::Command::Apply => apply(&args)?, args::Command::Apply => apply(&args)?,
args::Command::Context => { args::Command::Context => {
let repo = SiloRepo::open(&args.repo)?; let repo = SiloRepo::open(&args.repo)?;
@ -98,8 +98,7 @@ fn init_remote(args: &Args, _init_args: &InitArgs, remote: &str) -> Result<()> {
.0 .0
.main_worktree(Discard, &interrupt) .main_worktree(Discard, &interrupt)
.into_diagnostic() .into_diagnostic()
.context("checkout main")? .context("checkout main")?;
.0;
log::info!("Repo initialized at {:?}", args.repo); log::info!("Repo initialized at {:?}", args.repo);
Ok(()) Ok(())
} }

@ -96,7 +96,7 @@ impl DirEntry {
let entry_path = read_entry.path(); let entry_path = read_entry.path();
let test_path = entry_path.strip_prefix(&path).into_diagnostic()?; let test_path = entry_path.strip_prefix(&path).into_diagnostic()?;
if !IGNORED_PATHS.is_match(&test_path) && !ctx.ignored.is_match(&test_path) { if !IGNORED_PATHS.is_match(test_path) && !ctx.ignored.is_match(test_path) {
children.push(DirEntry::parse(ctx.clone(), entry_path)?); children.push(DirEntry::parse(ctx.clone(), entry_path)?);
} else { } else {
log::debug!("Entry {entry_path:?} is ignored") log::debug!("Entry {entry_path:?} is ignored")

@ -45,10 +45,10 @@ impl Hooks {
pub fn parse(path: &Path) -> Result<Self> { pub fn parse(path: &Path) -> Result<Self> {
log::debug!("Parsing hooks in {path:?}"); log::debug!("Parsing hooks in {path:?}");
let mut readdir = fs::read_dir(path).into_diagnostic()?; let readdir = fs::read_dir(path).into_diagnostic()?;
let mut scripts = Vec::new(); let mut scripts = Vec::new();
while let Some(entry) = readdir.next() { for entry in readdir {
let path = entry.into_diagnostic()?.path(); let path = entry.into_diagnostic()?.path();
if path.is_file() && path.extension().is_some_and(|e| e == "nu") { if path.is_file() && path.extension().is_some_and(|e| e == "nu") {

@ -12,10 +12,10 @@ pub fn register_require(lua: &Lua) -> Result<()> {
Ok(()) Ok(())
} }
fn lua_require<'a>(lua: &'a Lua, module: String) -> Result<Table<'a>> { fn lua_require(lua: &Lua, module: String) -> Result<Table<'_>> {
match module.as_str() { match module.as_str() {
"silo" => silo_module(&lua), "silo" => silo_module(lua),
"log" => log_module(&lua), "log" => log_module(lua),
_ => { _ => {
let old_require: mlua::Function = lua.globals().get("old_require")?; let old_require: mlua::Function = lua.globals().get("old_require")?;
old_require.call(module) old_require.call(module)

@ -35,7 +35,6 @@ impl HelperDef for IfInstalledHelper {
.ok_or_else(|| RenderErrorReason::BlockContentRequired)? .ok_or_else(|| RenderErrorReason::BlockContentRequired)?
.render(r, ctx, rc, out) .render(r, ctx, rc, out)
.map_err(RenderError::from) .map_err(RenderError::from)
.into()
} else { } else {
log::debug!("`{bin}` is not installed"); log::debug!("`{bin}` is not installed");
HelperResult::Ok(()) HelperResult::Ok(())

@ -32,7 +32,7 @@ pub fn context<'a, T: Serialize>(ctx: T) -> WrappedContext<'a, T> {
lazy_static! { lazy_static! {
static ref CTX: ContextData = ContextData::default(); static ref CTX: ContextData = ContextData::default();
} }
WrappedContext { data: &*CTX, ctx } WrappedContext { data: &CTX, ctx }
} }
#[derive(Serialize)] #[derive(Serialize)]

Loading…
Cancel
Save