Skip to content

Commit

Permalink
Fixed clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasLYang committed Jul 12, 2024
1 parent 5dcfd13 commit 1e407f3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 1 addition & 4 deletions crates/turborepo-repository/src/package_graph/builder.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use std::{
backtrace::Backtrace,
collections::{BTreeMap, HashMap, HashSet},
};
use std::collections::{BTreeMap, HashMap, HashSet};

use miette::Diagnostic;
use petgraph::graph::{Graph, NodeIndex};
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-repository/src/package_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use globwalk::{fix_glob_pattern, ValidatedGlob};
use itertools::{Either, Itertools};
use lazy_regex::{lazy_regex, Lazy};
use miette::{Diagnostic, NamedSource, SourceSpan};
use npm::NpmDetector;
use node_semver::SemverError;
use npm::NpmDetector;
use regex::Regex;
use serde::{Deserialize, Serialize};
use thiserror::Error;
Expand Down
10 changes: 9 additions & 1 deletion crates/turborepo-repository/src/package_manager/yarn.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::process::Command;

use miette::NamedSource;
use node_semver::{Range, Version};
use turbopath::{AbsoluteSystemPath, RelativeUnixPath};
use which::which;
Expand Down Expand Up @@ -32,7 +33,14 @@ impl<'a> YarnDetector<'a> {
.current_dir(self.repo_root)
.output()?;
let yarn_version_output = String::from_utf8(output.stdout)?;
Ok(yarn_version_output.trim().parse()?)
yarn_version_output
.trim()
.parse()
.map_err(|err| Error::InvalidVersion {
explanation: format!("{} {}", yarn_version_output, err),
span: None,
text: NamedSource::new("yarn --version", yarn_version_output),
})
}

pub fn detect_berry_or_yarn(version: &Version) -> Result<PackageManager, Error> {
Expand Down

0 comments on commit 1e407f3

Please sign in to comment.