mirror of
https://github.com/theryangeary/choose
synced 2025-02-17 01:38:24 +00:00
clippy things
This commit is contained in:
parent
ee393bd4e4
commit
24f8578640
3 changed files with 8 additions and 6 deletions
10
src/main.rs
10
src/main.rs
|
@ -42,10 +42,10 @@ fn main() {
|
|||
// BrokenPipe means whoever is reading the output hung up, we should
|
||||
// gracefully exit
|
||||
} else {
|
||||
eprintln!("Failed to write to output: {}", e)
|
||||
eprintln!("Failed to write to output: {}", e);
|
||||
}
|
||||
}
|
||||
e @ _ => eprintln!("Error: {}", e),
|
||||
e => eprintln!("Error: {}", e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,11 +73,11 @@ fn main_generic<W: WriteReceiver>(opt: Opt, handle: &mut W) -> Result<()> {
|
|||
match line {
|
||||
Ok(l) => {
|
||||
let l = if (config.opt.character_wise || config.opt.field_separator.is_some())
|
||||
&& l.ends_with("\n")
|
||||
&& l.ends_with('\n')
|
||||
{
|
||||
&l[0..l.len().saturating_sub(1)]
|
||||
} else {
|
||||
&l
|
||||
l
|
||||
};
|
||||
|
||||
let choice_iter = &mut config.opt.choices.iter().peekable();
|
||||
|
@ -89,7 +89,7 @@ fn main_generic<W: WriteReceiver>(opt: Opt, handle: &mut W) -> Result<()> {
|
|||
}
|
||||
}
|
||||
|
||||
handle.write(b"\n").map(|_| ())?
|
||||
handle.write(b"\n").map(|_| ())?;
|
||||
}
|
||||
Err(e) => println!("Failed to read line: {}", e),
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use bpaf::*;
|
||||
use bpaf::Bpaf;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::choice::Choice;
|
||||
|
|
|
@ -64,6 +64,8 @@ pub fn choice(src: &str) -> Result<Choice, ParseError> {
|
|||
Ok(Choice::new(start, end, kind))
|
||||
}
|
||||
|
||||
// bpaf's parse gives String by value so type signature needs to match
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
pub fn output_field_separator(src: String) -> String {
|
||||
escape_ascii(&src).unwrap()
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue