Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
denisidoro authored Aug 7, 2021
1 parent 8cee230 commit 5e7b24a
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?
Expand Down
8 changes: 4 additions & 4 deletions src/config/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/config/yaml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
2 changes: 1 addition & 1 deletion src/finder/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/handler/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/structures/cheat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/tldr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/welcome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, _| {
Expand Down

0 comments on commit 5e7b24a

Please sign in to comment.