run cargo clippy --fix
This commit is contained in:
parent
8c52d3668e
commit
a896e66cca
7 changed files with 30 additions and 33 deletions
|
@ -88,7 +88,7 @@ fn check_missing_filters(syntax: &[PipelineElement]) -> Result<(), Vec<logos::Sp
|
|||
}),
|
||||
) = (syntax.get(i), syntax.get(i + 1))
|
||||
{
|
||||
missing_filter_locs.push(span.start..span1.end)
|
||||
missing_filter_locs.push(span.start..span1.end);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ fn test_check_missing_streamer() {
|
|||
let test_data = "| invert | save \"./image_processed.jpg\"";
|
||||
let syntax = parse_syntax(test_data).unwrap();
|
||||
|
||||
assert_eq!(check_missing_streamer(&syntax), Err(0..1))
|
||||
assert_eq!(check_missing_streamer(&syntax), Err(0..1));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -19,7 +19,7 @@ fn test_check_missing_filters() {
|
|||
let test_data = "meow | | test | awa | | nya";
|
||||
let syntax = parse_syntax(test_data).unwrap();
|
||||
|
||||
assert_eq!(check_missing_filters(&syntax), Err(vec![5..8, 20..25]))
|
||||
assert_eq!(check_missing_filters(&syntax), Err(vec![5..8, 20..25]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -27,7 +27,7 @@ fn test_check_missing_sink() {
|
|||
let test_data = "meow | invert | ";
|
||||
let syntax = parse_syntax(test_data).unwrap();
|
||||
|
||||
assert_eq!(check_missing_sink(&syntax), Err(14..15))
|
||||
assert_eq!(check_missing_sink(&syntax), Err(14..15));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -35,7 +35,7 @@ fn test_check_literal_as_sink() {
|
|||
let test_data = "meow | test | 3";
|
||||
let syntax = parse_syntax(test_data).unwrap();
|
||||
|
||||
assert_eq!(check_literal_as_sink(&syntax), Err(14..15))
|
||||
assert_eq!(check_literal_as_sink(&syntax), Err(14..15));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -46,7 +46,7 @@ fn test_check_literal_as_filter() {
|
|||
assert_eq!(
|
||||
check_literal_as_filter(&syntax),
|
||||
Err(vec![7..12, 15..17, 20..24])
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -54,7 +54,7 @@ fn test_check_literal_as_filter_positive_on_sink() {
|
|||
let test_data = "meow | 42";
|
||||
let syntax = parse_syntax(test_data).unwrap();
|
||||
|
||||
assert_eq!(check_literal_as_filter(&syntax), Ok(()))
|
||||
assert_eq!(check_literal_as_filter(&syntax), Ok(()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -62,5 +62,5 @@ fn test_check_literal_with_args() {
|
|||
let test_data = "14 12 | sink";
|
||||
let syntax = parse_syntax(test_data).unwrap();
|
||||
|
||||
assert_eq!(check_literal_with_args(&syntax), Err(0..5))
|
||||
assert_eq!(check_literal_with_args(&syntax), Err(0..5));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::mem;
|
||||
|
||||
|
||||
use logos::Logos;
|
||||
use logos::Span;
|
||||
|
@ -40,7 +40,7 @@ pub fn parse_syntax(input: &str) -> Result<Vec<PipelineElement>, Vec<logos::Span
|
|||
let mut r = Vec::new();
|
||||
|
||||
let mut partial_command: Vec<CommandPart> = Vec::new();
|
||||
for (tok, span) in lexer.spanned().into_iter() {
|
||||
for (tok, span) in lexer.spanned() {
|
||||
if let Ok(tok) = tok {
|
||||
match tok {
|
||||
Token::Pipe => {
|
||||
|
@ -52,10 +52,7 @@ pub fn parse_syntax(input: &str) -> Result<Vec<PipelineElement>, Vec<logos::Span
|
|||
let span = partial_command.first().unwrap().span.start
|
||||
..partial_command.last().unwrap().span.end;
|
||||
r.push(PipelineElement {
|
||||
kind: PipelineElementKind::Command(mem::replace(
|
||||
&mut partial_command,
|
||||
Vec::new(),
|
||||
)),
|
||||
kind: PipelineElementKind::Command(std::mem::take(&mut partial_command)),
|
||||
span,
|
||||
});
|
||||
}
|
||||
|
@ -83,7 +80,7 @@ pub fn parse_syntax(input: &str) -> Result<Vec<PipelineElement>, Vec<logos::Span
|
|||
_ => {}
|
||||
}
|
||||
} else {
|
||||
errs.push(span)
|
||||
errs.push(span);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,5 +107,5 @@ pub fn parse_syntax(input: &str) -> Result<Vec<PipelineElement>, Vec<logos::Span
|
|||
#[test]
|
||||
fn test_invalid_toks() {
|
||||
let test_data = "meow | gay $ error!";
|
||||
assert_eq!(parse_syntax(test_data), Err(vec![11..12, 18..19]))
|
||||
assert_eq!(parse_syntax(test_data), Err(vec![11..12, 18..19]));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue