Fix clippy warnings
This commit is contained in:
parent
9b88539c50
commit
3355763992
@ -55,7 +55,7 @@ fn run_inner(app: &mut App) -> Result<CommandResult> {
|
||||
let mut stdin = child.stdin.take().context("Could not take stdin")?;
|
||||
let text_orig_clone = app.text_orig.clone();
|
||||
std::thread::spawn(move || {
|
||||
let _ = stdin.write_all(text_orig_clone.as_bytes());
|
||||
let _result = stdin.write_all(text_orig_clone.as_bytes());
|
||||
});
|
||||
|
||||
// Collect the output
|
||||
|
35
src/main.rs
35
src/main.rs
@ -63,7 +63,7 @@ impl App {
|
||||
let cmdline_position = 0;
|
||||
|
||||
match template {
|
||||
Template::Generic(_) => Self {
|
||||
Template::Awk | Template::Generic(_) => Self {
|
||||
cmdline: String::new(),
|
||||
cmdline_position,
|
||||
text_orig,
|
||||
@ -82,8 +82,8 @@ impl App {
|
||||
hidden_options: vec!["-C"],
|
||||
},
|
||||
Template::Grep | Template::Rg => Self {
|
||||
cmdline: String::from("'^'"),
|
||||
cmdline_position: 2,
|
||||
cmdline: String::from("''"),
|
||||
cmdline_position: 1,
|
||||
text_orig,
|
||||
command_result: CommandResult::default(),
|
||||
autorun: true,
|
||||
@ -99,15 +99,6 @@ impl App {
|
||||
command,
|
||||
hidden_options: vec![],
|
||||
},
|
||||
Template::Awk => Self {
|
||||
cmdline: String::new(),
|
||||
cmdline_position,
|
||||
text_orig,
|
||||
command_result: CommandResult::default(),
|
||||
autorun: true,
|
||||
command,
|
||||
hidden_options: vec![],
|
||||
},
|
||||
Template::Perl => Self {
|
||||
cmdline: String::from("-p -e 's///'"),
|
||||
cmdline_position: 10_u16,
|
||||
@ -132,7 +123,8 @@ pub enum Template {
|
||||
}
|
||||
|
||||
impl Template {
|
||||
pub fn from(s: String) -> Self {
|
||||
#[must_use]
|
||||
pub fn from(s: &str) -> Self {
|
||||
match s.to_lowercase().trim() {
|
||||
"jq" => Self::Jq,
|
||||
"grep" => Self::Grep,
|
||||
@ -144,15 +136,16 @@ impl Template {
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn command(&self) -> String {
|
||||
match self {
|
||||
Template::Generic(c) => c.to_string(),
|
||||
Template::Jq => String::from("jq"),
|
||||
Template::Grep => String::from("grep"),
|
||||
Template::Rg => String::from("rg"),
|
||||
Template::Sed => String::from("sed"),
|
||||
Template::Awk => String::from("awk"),
|
||||
Template::Perl => String::from("perl"),
|
||||
Self::Generic(c) => c.to_string(),
|
||||
Self::Jq => String::from("jq"),
|
||||
Self::Grep => String::from("grep"),
|
||||
Self::Rg => String::from("rg"),
|
||||
Self::Sed => String::from("sed"),
|
||||
Self::Awk => String::from("awk"),
|
||||
Self::Perl => String::from("perl"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -185,7 +178,7 @@ fn main() -> Result<()> {
|
||||
let text_orig = io::read_to_string(io::stdin())?;
|
||||
|
||||
// Run the actual application
|
||||
let app = App::from_template(text_orig, &Template::from(arg));
|
||||
let app = App::from_template(text_orig, &Template::from(&arg));
|
||||
let res = run_app(&mut terminal, app);
|
||||
|
||||
// Restore terminal
|
||||
|
Loading…
Reference in New Issue
Block a user