Skip to content

Commit

Permalink
Fill missing docs in resolver area and remove unnecessary method (#938)
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Kaput <[email protected]>
  • Loading branch information
mkaput authored Nov 24, 2023
1 parent 5979a2e commit 6868661
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scarb/src/core/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl Lockfile {
.map(|dep| dep.name.clone())
.collect::<BTreeSet<_>>();

let summary = resolve.summary(package);
let summary = &resolve.summaries[&package];

PackageLock::builder()
.use_package_id(package)
Expand Down
5 changes: 1 addition & 4 deletions scarb/src/core/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub struct Resolve {
///
/// If package `a` depends on package `b`, then this graph will contain an edge from `a` to `b`.
pub graph: DiGraphMap<PackageId, DependencyEdge>,
/// Summaries of all packages in the graph.
pub summaries: HashMap<PackageId, Summary>,
}

Expand Down Expand Up @@ -53,10 +54,6 @@ impl Resolve {
self.graph
.neighbors_directed(package_id, petgraph::Direction::Outgoing)
}

pub fn summary(&self, package_id: PackageId) -> &Summary {
&self.summaries[&package_id]
}
}

#[derive(Debug, Default, Clone, PartialEq, Eq)]
Expand Down
6 changes: 6 additions & 0 deletions scarb/src/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ use crate::core::{
/// our requests to it (aka returns the same results for the same query every time).
/// It is also advised to implement internal caching, as the resolver may frequently ask
/// repetitive queries.
///
/// * `lockfile` - a [`Lockfile`] instance, which is used to guide the resolution process. Empty
/// lockfile will result in no guidance. This function does not read or write lock files from
/// the filesystem.
///
/// * `ui` - an [`Ui`] instance used to show warnings to the user.
#[tracing::instrument(level = "trace", skip_all)]
pub async fn resolve(
summaries: &[Summary],
Expand Down

0 comments on commit 6868661

Please sign in to comment.