fix: use clippy fix

This commit is contained in:
mrxiaozhuox committed 2022-01-25 13:52:33 +08:00
1 parent 84d1867654
commit 1c2cf3330e
7 files changed
+22 -24

No files matched your search

+3 -3
View File
@@ -1,6 +1,6 @@
//! Utilities for working with cargo and rust files
use crate::error::{Error, Result};
use std::{env, fs, path::PathBuf, process::Command, str};
use std::{env, fs, path::{PathBuf, Path}, process::Command, str};
/// How many parent folders are searched for a `Cargo.toml`
const MAX_ANCESTORS: u32 = 10;
@@ -44,7 +44,7 @@ pub fn workspace_root() -> Result<PathBuf> {
}
let stdout = str::from_utf8(&output.stdout).unwrap();
for line in stdout.lines() {
if let Some(line) = stdout.lines().next() {
let meta: serde_json::Value = serde_json::from_str(line)
.map_err(|_| Error::CargoError("InvalidOutput".to_string()))?;
@@ -58,7 +58,7 @@ pub fn workspace_root() -> Result<PathBuf> {
}
/// Checks if the directory contains `Cargo.toml`
fn contains_manifest(path: &PathBuf) -> bool {
fn contains_manifest(path: &Path) -> bool {
fs::read_dir(path)
.map(|entries| {
entries