Merge pull request #892 from tolik518/linter-fix-for-fzf-issue

Fixed failing linter
This commit is contained in:
Denis Isidoro 2024-05-06 22:05:49 -03:00 committed by GitHub
commit 78c5aaf9e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 15 deletions

View file

@ -1,5 +1,5 @@
use crate::prelude::*;
use crate::config::CONFIG; use crate::config::CONFIG;
use crate::prelude::*;
use std::process::{Command, Stdio}; use std::process::{Command, Stdio};
lazy_static! { lazy_static! {

View file

@ -172,8 +172,6 @@ impl Default for Shell {
impl Default for Client { impl Default for Client {
fn default() -> Self { fn default() -> Self {
Self { Self { tealdeer: false }
tealdeer: false,
}
} }
} }

View file

@ -52,11 +52,7 @@ fn parse(out: Output, opts: Opts) -> Result<String> {
impl FinderChoice { impl FinderChoice {
fn check_fzf_version() -> Option<(u32, u32, u32)> { fn check_fzf_version() -> Option<(u32, u32, u32)> {
let output = Command::new("fzf") let output = Command::new("fzf").arg("--version").output().ok()?.stdout;
.arg("--version")
.output()
.ok()?
.stdout;
let version_string = String::from_utf8(output).ok()?; let version_string = String::from_utf8(output).ok()?;
let version_parts: Vec<_> = version_string.split('.').collect(); let version_parts: Vec<_> = version_string.split('.').collect();
if version_parts.len() == 3 { if version_parts.len() == 3 {
@ -80,12 +76,17 @@ impl FinderChoice {
if let Self::Fzf = self { if let Self::Fzf = self {
if let Some((major, minor, patch)) = Self::check_fzf_version() { 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 { if major == MIN_FZF_VERSION_MAJOR
eprintln!("Warning: Fzf version {}.{} does not support the preview window layout used by navi.", major, minor); && minor < MIN_FZF_VERSION_MINOR
eprintln!("Consider updating Fzf to a version >= {}.{}.{} or use a compatible layout.", && patch < MIN_FZF_VERSION_PATCH
MIN_FZF_VERSION_MAJOR, {
MIN_FZF_VERSION_MINOR, eprintln!(
MIN_FZF_VERSION_PATCH "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
); );
process::exit(1); process::exit(1);
} }