Skip to content

Commit

Permalink
Merge 0f6365a into 2c20592
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaBatty committed May 2, 2024
2 parents 2c20592 + 0f6365a commit 17605d3
Show file tree
Hide file tree
Showing 97 changed files with 542 additions and 530 deletions.
8 changes: 4 additions & 4 deletions forc-pkg/src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ impl Lock {
.map_err(|e| anyhow!("failed to parse dependency \"{}\": {}", dep_line, e))?;
let dep_node = pkg_to_node
.get(dep_key)
.cloned()
.copied()
.ok_or_else(|| anyhow!("found dep {} without node entry in graph", dep_key))?;
let dep_name = dep_name.unwrap_or(&graph[dep_node].name).to_string();
let dep_kind = match dep_kind {
Expand Down Expand Up @@ -337,8 +337,8 @@ fn parse_pkg_dep_line(pkg_dep_line: &str) -> anyhow::Result<ParsedPkgLine> {
}

pub fn print_diff(member_names: &HashSet<String>, diff: &Diff) {
print_removed_pkgs(member_names, diff.removed.iter().cloned());
print_added_pkgs(member_names, diff.added.iter().cloned());
print_removed_pkgs(member_names, diff.removed.iter().copied());
print_added_pkgs(member_names, diff.added.iter().copied());
}

pub fn print_removed_pkgs<'a, I>(member_names: &HashSet<String>, removed: I)
Expand All @@ -349,7 +349,7 @@ where
if !member_names.contains(&pkg.name) {
let src = match pkg.source.starts_with(source::git::Pinned::PREFIX) {
true => format!(" {}", pkg.source),
false => "".to_string(),
false => String::new(),
};
tracing::info!(
" {} {}{src}",
Expand Down
8 changes: 4 additions & 4 deletions forc-pkg/src/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,18 +339,18 @@ impl PackageManifestFile {

parse_res.map_err(|_| {
let (errors, _warnings) = handler.consume();
parsing_failed(&self.project.name, errors)
parsing_failed(&self.project.name, &errors)
})
}

/// Given the current directory and expected program type,
/// determines whether the correct program type is present.
pub fn check_program_type(&self, expected_types: Vec<TreeType>) -> Result<()> {
pub fn check_program_type(&self, expected_types: &[TreeType]) -> Result<()> {
let parsed_type = self.program_type()?;
if !expected_types.contains(&parsed_type) {
bail!(wrong_program_type(
&self.project.name,
expected_types,
&expected_types,
parsed_type
));
} else {
Expand Down Expand Up @@ -934,7 +934,7 @@ impl WorkspaceManifest {
/// This checks if the listed members in the `WorkspaceManifest` are indeed in the given `Forc.toml`'s directory.
pub fn validate(&self, path: &Path) -> Result<()> {
let mut pkg_name_to_paths: HashMap<String, Vec<PathBuf>> = HashMap::new();
for member in self.workspace.members.iter() {
for member in &self.workspace.members {
let member_path = path.join(member).join("Forc.toml");
if !member_path.exists() {
bail!(
Expand Down

0 comments on commit 17605d3

Please sign in to comment.