1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-24 21:57:41 +00:00

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
This commit is contained in:
Thomas O'Donnell 2020-03-14 16:37:51 +01:00 committed by GitHub
parent cae6a3dfc3
commit f790b67e3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

@ -1,7 +1,7 @@
use std::ffi::OsStr; use std::ffi::OsStr;
use std::iter::Iterator; use std::iter::Iterator;
use std::ops::Deref; use std::ops::Deref;
use std::path::{Path, PathBuf}; use std::path::Path;
use std::str; use std::str;
use super::{Context, Module, RootModuleConfig}; use super::{Context, Module, RootModuleConfig};
@ -31,10 +31,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
// Typically it is twice as fast as running `dotnet --version`. // Typically it is twice as fast as running `dotnet --version`.
let enable_heuristic = config.heuristic; let enable_heuristic = config.heuristic;
let version = if enable_heuristic { let version = if enable_heuristic {
let repo_root = context let repo_root = context.get_repo().ok().and_then(|r| r.root.as_deref());
.get_repo()
.ok()
.and_then(|r| r.root.as_ref().map(PathBuf::as_path));
estimate_dotnet_version(&dotnet_files, &context.current_dir, repo_root)? estimate_dotnet_version(&dotnet_files, &context.current_dir, repo_root)?
} else { } else {
get_version_from_cli()? get_version_from_cli()?

View File

@ -47,7 +47,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let kube_cfg = match env::var("KUBECONFIG") { let kube_cfg = match env::var("KUBECONFIG") {
Ok(paths) => env::split_paths(&paths) Ok(paths) => env::split_paths(&paths)
.filter_map(|filename| parse_kubectl_file(&filename)) .filter_map(|filename| parse_kubectl_file(&filename))
.nth(0), .next(),
Err(_) => { Err(_) => {
let filename = dirs::home_dir()?.join(".kube").join("config"); let filename = dirs::home_dir()?.join(".kube").join("config");
parse_kubectl_file(&filename) parse_kubectl_file(&filename)