From f790b67e3d0ba77bddeb295c50eb2b4661b27145 Mon Sep 17 00:00:00 2001 From: Thomas O'Donnell Date: Sat, 14 Mar 2020 16:37:51 +0100 Subject: [PATCH] refactor: Fix new Clippy suggestions (#1006) * Fix new Clippy suggestions This just cleans up a few new suggestions from Clippy. * Dummy commit to trigger CI --- src/modules/dotnet.rs | 7 ++----- src/modules/kubernetes.rs | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/modules/dotnet.rs b/src/modules/dotnet.rs index 5ca4d636..592bd59e 100644 --- a/src/modules/dotnet.rs +++ b/src/modules/dotnet.rs @@ -1,7 +1,7 @@ use std::ffi::OsStr; use std::iter::Iterator; use std::ops::Deref; -use std::path::{Path, PathBuf}; +use std::path::Path; use std::str; use super::{Context, Module, RootModuleConfig}; @@ -31,10 +31,7 @@ pub fn module<'a>(context: &'a Context) -> Option> { // Typically it is twice as fast as running `dotnet --version`. let enable_heuristic = config.heuristic; let version = if enable_heuristic { - let repo_root = context - .get_repo() - .ok() - .and_then(|r| r.root.as_ref().map(PathBuf::as_path)); + let repo_root = context.get_repo().ok().and_then(|r| r.root.as_deref()); estimate_dotnet_version(&dotnet_files, &context.current_dir, repo_root)? } else { get_version_from_cli()? diff --git a/src/modules/kubernetes.rs b/src/modules/kubernetes.rs index c8d55be1..018fd45a 100644 --- a/src/modules/kubernetes.rs +++ b/src/modules/kubernetes.rs @@ -47,7 +47,7 @@ pub fn module<'a>(context: &'a Context) -> Option> { let kube_cfg = match env::var("KUBECONFIG") { Ok(paths) => env::split_paths(&paths) .filter_map(|filename| parse_kubectl_file(&filename)) - .nth(0), + .next(), Err(_) => { let filename = dirs::home_dir()?.join(".kube").join("config"); parse_kubectl_file(&filename)