Fix clippy warnings

This commit is contained in:
Denis Isidoro 2021-08-07 07:05:33 -03:00 committed by GitHub
parent 8cee230313
commit 5e7b24abe8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 14 additions and 14 deletions

View file

@ -165,7 +165,7 @@ fn replace_variables_from_snippet(snippet: &str, tags: &str, variables: Variable
let value = if let Ok(e) = env_value {
e
} else if let Some(suggestion) = variables.get_suggestion(&tags, &variable_name) {
} else if let Some(suggestion) = variables.get_suggestion(tags, variable_name) {
let mut new_suggestion = suggestion.clone();
new_suggestion.0 = replace_variables_from_snippet(&new_suggestion.0, tags, variables.clone())?;
prompt_finder(variable_name, Some(&new_suggestion), variable_count)?

View file

@ -8,10 +8,10 @@ use clap::{crate_version, AppSettings, Clap};
use std::str::FromStr;
const FINDER_POSSIBLE_VALUES: &[&str] = &[&"fzf", &"skim"];
const WIDGET_POSSIBLE_VALUES: &[&str] = &[&"bash", &"zsh", &"fish"];
const FUNC_POSSIBLE_VALUES: &[&str] = &[&"url::open", &"welcome", &"widget::last_command", &"map::expand"];
const INFO_POSSIBLE_VALUES: &[&str] = &[&"cheats-path", "config-path", "config-example"];
const FINDER_POSSIBLE_VALUES: &[&str] = &["fzf", "skim"];
const WIDGET_POSSIBLE_VALUES: &[&str] = &["bash", "zsh", "fish"];
const FUNC_POSSIBLE_VALUES: &[&str] = &["url::open", "welcome", "widget::last_command", "map::expand"];
const INFO_POSSIBLE_VALUES: &[&str] = &["cheats-path", "config-path", "config-example"];
impl FromStr for Shell {
type Err = &'static str;

View file

@ -93,7 +93,7 @@ pub struct YamlConfig {
impl YamlConfig {
fn from_str(text: &str) -> Result<Self> {
serde_yaml::from_str(&text).map_err(|e| e.into())
serde_yaml::from_str(text).map_err(|e| e.into())
}
fn from_path(path: &Path) -> Result<Self> {

View file

@ -40,7 +40,7 @@ fn get_column(text: String, column: Option<u8>, delimiter: Option<&str>) -> Stri
let mut result = String::from("");
let re = regex::Regex::new(delimiter.unwrap_or(r"\s\s+")).expect("Invalid regex");
for line in text.split('\n') {
if (&line).is_empty() {
if (line).is_empty() {
continue;
}
let mut parts = re.split(line).skip((c - 1) as usize);

View file

@ -15,7 +15,7 @@ use anyhow::Result;
pub fn main() -> Result<()> {
let config = &CONFIG;
let opts = FinderOpts::from_config(&config)?;
let opts = FinderOpts::from_config(config)?;
let (raw_selection, variables, files) = config
.finder()

View file

@ -206,7 +206,7 @@ pub fn read_lines(
id
)
})?;
variables.insert_suggestion(&item.tags, &variable, (String::from(command), opts));
variables.insert_suggestion(&item.tags, variable, (String::from(command), opts));
}
// snippet
else {

View file

@ -70,8 +70,8 @@ pub fn widget_last_command() -> Result<()> {
}
for (pattern, escaped) in replacements.clone() {
text = text.replace(&escaped, &pattern);
extracted = extracted.replace(&escaped, &pattern);
text = text.replace(&escaped, pattern);
extracted = extracted.replace(&escaped, pattern);
}
println!("{}", extracted.trim_start());

View file

@ -52,7 +52,7 @@ impl VariableMap {
if let Some(dependency_keys) = self.dependencies.get(&k) {
for dependency_key in dependency_keys {
if let Some(vm) = self.variables.get(&dependency_key) {
if let Some(vm) = self.variables.get(dependency_key) {
let res = vm.get(variable);
if res.is_some() {
return res;

View file

@ -16,7 +16,7 @@ static VERSION_DISCLAIMER: &str = "The tldr client written in C (the default one
The client written in Rust is recommended. The one available in npm works, too.";
fn convert_tldr_vars(line: &str) -> String {
let caps = VAR_TLDR_REGEX.find_iter(&line);
let caps = VAR_TLDR_REGEX.find_iter(line);
let mut new_line: String = line.to_string();
for cap in caps {
let braced_var = cap.as_str();

View file

@ -12,7 +12,7 @@ use std::io::Write;
pub fn main() -> Result<()> {
let config = &CONFIG;
let opts = FinderOpts::from_config(&config)?;
let opts = FinderOpts::from_config(config)?;
let (raw_selection, variables, files) = config
.finder()
.call(opts, |stdin, _| {