fix/allow clippy errors

This commit is contained in:
Schrottkatze 2023-11-20 10:27:47 +01:00
parent 55acd88f0a
commit 8c52d3668e
9 changed files with 51 additions and 30 deletions

View file

@ -1,4 +1,5 @@
#[cfg(test)]
#[allow(clippy::unwrap_used, reason = "these are tests. they may unwrap.")]
mod test;
use crate::{

View file

@ -45,6 +45,10 @@ pub fn parse_syntax(input: &str) -> Result<Vec<PipelineElement>, Vec<logos::Span
match tok {
Token::Pipe => {
if !partial_command.is_empty() {
#[allow(
clippy::unwrap_used,
reason = "this branch can only run if partial_command isn't empty"
)]
let span = partial_command.first().unwrap().span.start
..partial_command.last().unwrap().span.end;
r.push(PipelineElement {
@ -84,6 +88,10 @@ pub fn parse_syntax(input: &str) -> Result<Vec<PipelineElement>, Vec<logos::Span
}
if !partial_command.is_empty() {
#[allow(
clippy::unwrap_used,
reason = "this branch can only run if partial_command isn't empty"
)]
let span =
partial_command.first().unwrap().span.start..partial_command.last().unwrap().span.end;
r.push(PipelineElement {