Run clippy

main
trivernis 9 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()
.into();
}
&*DEFAULT_REPO
&DEFAULT_REPO
}

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

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

@ -96,7 +96,7 @@ impl DirEntry {
let entry_path = read_entry.path();
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)?);
} else {
log::debug!("Entry {entry_path:?} is ignored")

@ -45,10 +45,10 @@ impl Hooks {
pub fn parse(path: &Path) -> Result<Self> {
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();
while let Some(entry) = readdir.next() {
for entry in readdir {
let path = entry.into_diagnostic()?.path();
if path.is_file() && path.extension().is_some_and(|e| e == "nu") {

@ -12,10 +12,10 @@ pub fn register_require(lua: &Lua) -> Result<()> {
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() {
"silo" => silo_module(&lua),
"log" => log_module(&lua),
"silo" => silo_module(lua),
"log" => log_module(lua),
_ => {
let old_require: mlua::Function = lua.globals().get("old_require")?;
old_require.call(module)

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

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

Loading…
Cancel
Save