diff --git a/src/main.rs b/src/main.rs index e240072..628973d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -133,7 +133,7 @@ fn run_command(args: Args) -> Result<()> { println!("Git state:"); yolk.paths() .start_git_command_builder()? - .args(&["status", "--short"]) + .args(["status", "--short"]) .status() .into_diagnostic()?; } diff --git a/src/templating/comment_style.rs b/src/templating/comment_style.rs index afb96fc..0d1b745 100644 --- a/src/templating/comment_style.rs +++ b/src/templating/comment_style.rs @@ -35,7 +35,7 @@ impl CommentStyle { tagged_line: line, .. }, .. - } => &line, + } => line, Element::Conditional { blocks, .. } => &blocks.first()?.tagged_line, Element::Plain(_) => return None, }; diff --git a/src/templating/parser.rs b/src/templating/parser.rs index 528f637..f77ce9e 100644 --- a/src/templating/parser.rs +++ b/src/templating/parser.rs @@ -41,7 +41,7 @@ impl<'a> Sp<&'a str> { } } -impl<'a, T> Sp { +impl Sp { fn new(range: Range, content: T) -> Self { Self { range, content } } @@ -68,13 +68,13 @@ pub struct TaggedLine<'a> { pub full_line: Sp<&'a str>, } -pub fn parse_document<'a>(s: &'a str) -> Result>, YolkParseFailure> { +pub fn parse_document(s: &str) -> Result>, YolkParseFailure> { let p = repeat(0.., p_element); try_parse(p, s) } #[allow(unused)] -pub fn parse_element<'a>(s: &'a str) -> Result, YolkParseFailure> { +pub fn parse_element(s: &str) -> Result, YolkParseFailure> { let p = terminated(p_element, repeat(0.., line_ending).map(|_: ()| ())); try_parse(p, s) } @@ -93,7 +93,7 @@ pub fn try_parse<'a, P: Parser, T, YolkParseError>, T>( fn p_element<'a>(input: &mut Input<'a>) -> PResult> { trace("peek any", peek(any)).parse_next(input)?; - Ok(alt(( + alt(( p_inline_element.context(lbl("inline element")), p_nextline_element.context(lbl("nextline element")), p_conditional_element.context(lbl("conditional element")), @@ -101,12 +101,12 @@ fn p_element<'a>(input: &mut Input<'a>) -> PResult> { p_plain_line_element.context(lbl("plain line")), fail.context(lbl("valid element")), )) + .parse_next(input) // .resume_after( // repeat_till(1.., (not(line_ending), any), line_ending) // .map(|((), _)| ()) // .void(), // ) - .parse_next(input)?) // .unwrap_or_else(|| Element::Plain(Sp::new(0..0, "")))) } @@ -141,9 +141,7 @@ fn test_p_text_segment() -> TestResult { Ok(()) } -fn p_regular_tag_inner<'a>( - end: &'a str, -) -> impl winnow::Parser, &'a str, YolkParseError> { +fn p_regular_tag_inner(end: &str) -> impl winnow::Parser, &'_ str, YolkParseError> { trace("p_regular_tag_inner", move |i: &mut _| { repeat_till(1.., (not(line_ending), not(end), any), peek(end)) .map(|(_, _): ((), _)| ()) @@ -340,7 +338,7 @@ fn p_conditional_element<'a>(input: &mut Input<'a>) -> PResult> { let mut blocks = Vec::new(); blocks.push(if_body); - blocks.extend(elif_bodies.into_iter()); + blocks.extend(elif_bodies); Ok(Element::Conditional { blocks, else_block: else_block.map(|x| x.map_expr(|_| ())), diff --git a/src/yolk.rs b/src/yolk.rs index 4a39198..f835073 100644 --- a/src/yolk.rs +++ b/src/yolk.rs @@ -159,7 +159,7 @@ impl Yolk { .prepare_eval_ctx_for_templates(mode) .context("Failed to prepare eval_ctx")?; eval_ctx - .eval_lua::("expr", &expr)? + .eval_lua::("expr", expr)? .to_string() .into_diagnostic() } diff --git a/src/yolk_paths.rs b/src/yolk_paths.rs index d29daa4..e356bd9 100644 --- a/src/yolk_paths.rs +++ b/src/yolk_paths.rs @@ -119,7 +119,7 @@ impl YolkPaths { /// Start an invocation of the `git` command with the `--git-dir` and `--work-tree` set to the yolk git and root path. pub fn start_git_command_builder(&self) -> Result { let mut cmd = std::process::Command::new("git"); - cmd.current_dir(self.root_path()).args(&[ + cmd.current_dir(self.root_path()).args([ "--git-dir", &self.active_yolk_git_dir()?.to_string_lossy(), "--work-tree", @@ -296,11 +296,11 @@ fn check_is_deployed_recursive( let target_root = target_root.as_ref(); let egg_root = egg_root.as_ref(); let current = current.as_ref(); - let target_file = target_root.join(current.strip_prefix(&egg_root).into_diagnostic()?); + let target_file = target_root.join(current.strip_prefix(egg_root).into_diagnostic()?); if target_file.is_symlink() && target_file.canonical()? == current { - return Ok(true); + Ok(true) } else if target_file.is_file() { - return Ok(false); + Ok(false) } else if target_file.is_dir() { for entry in fs_err::read_dir(current).into_diagnostic()? { let entry = entry.into_diagnostic()?; @@ -308,9 +308,9 @@ fn check_is_deployed_recursive( return Ok(false); } } - return Ok(true); + Ok(true) } else { - return Ok(false); + Ok(false) } }