Skip to content

Commit

Permalink
Merge pull request #892 from tolik518/linter-fix-for-fzf-issue
Browse files Browse the repository at this point in the history
Fixed failing linter
  • Loading branch information
denisidoro authored May 7, 2024
2 parents d713d50 + d0d5622 commit 78c5aaf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/clients/tldr.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::prelude::*;
use crate::config::CONFIG;
use crate::prelude::*;
use std::process::{Command, Stdio};

lazy_static! {
Expand Down
4 changes: 1 addition & 3 deletions src/config/yaml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ impl Default for Shell {

impl Default for Client {

Check failure on line 173 in src/config/yaml.rs

View workflow job for this annotation

GitHub Actions / Lints

this `impl` can be derived
fn default() -> Self {
Self {
tealdeer: false,
}
Self { tealdeer: false }
}
}
23 changes: 12 additions & 11 deletions src/finder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ fn parse(out: Output, opts: Opts) -> Result<String> {

impl FinderChoice {
fn check_fzf_version() -> Option<(u32, u32, u32)> {
let output = Command::new("fzf")
.arg("--version")
.output()
.ok()?
.stdout;
let output = Command::new("fzf").arg("--version").output().ok()?.stdout;
let version_string = String::from_utf8(output).ok()?;
let version_parts: Vec<_> = version_string.split('.').collect();
if version_parts.len() == 3 {
Expand All @@ -80,12 +76,17 @@ impl FinderChoice {

if let Self::Fzf = self {
if let Some((major, minor, patch)) = Self::check_fzf_version() {
if major == MIN_FZF_VERSION_MAJOR && minor < MIN_FZF_VERSION_MINOR && patch < MIN_FZF_VERSION_PATCH {
eprintln!("Warning: Fzf version {}.{} does not support the preview window layout used by navi.", major, minor);
eprintln!("Consider updating Fzf to a version >= {}.{}.{} or use a compatible layout.",
MIN_FZF_VERSION_MAJOR,
MIN_FZF_VERSION_MINOR,
MIN_FZF_VERSION_PATCH
if major == MIN_FZF_VERSION_MAJOR
&& minor < MIN_FZF_VERSION_MINOR
&& patch < MIN_FZF_VERSION_PATCH
{
eprintln!(

Check failure on line 83 in src/finder/mod.rs

View workflow job for this annotation

GitHub Actions / Lints

variables can be used directly in the `format!` string
"Warning: Fzf version {}.{} does not support the preview window layout used by navi.",
major, minor
);
eprintln!(

Check failure on line 87 in src/finder/mod.rs

View workflow job for this annotation

GitHub Actions / Lints

variables can be used directly in the `format!` string
"Consider updating Fzf to a version >= {}.{}.{} or use a compatible layout.",
MIN_FZF_VERSION_MAJOR, MIN_FZF_VERSION_MINOR, MIN_FZF_VERSION_PATCH
);
process::exit(1);
}
Expand Down

0 comments on commit 78c5aaf

Please sign in to comment.