in guppy/src/graph/summaries/package_set.rs [624:663]
fn is_match(&mut self, metadata: PackageMetadata<'_>) -> bool {
// Don't short-circuit matches because we want to mark a
// TODO: maybe this should involve duplicate detection between summary_ids and workspace/
// third-party
let name = metadata.name();
let in_ids = match self.summary_ids.get_mut(&metadata.to_summary_id()) {
Some(is_match_store) => {
*is_match_store = true;
true
}
None => false,
};
let in_selectors = if metadata.in_workspace() {
self.workspace_members.contains(name)
} else {
let registry_names_to_urls = &self.registry_names_to_urls;
match self.third_party.get_mut(name) {
Some(matches) => {
let mut is_match = false;
for (summary, is_match_store) in matches {
if summary.version.matches(metadata.version())
&& Self::source_matches(
metadata.source(),
&summary.source,
registry_names_to_urls,
)
{
// This is a match.
is_match = true;
*is_match_store = true;
}
}
is_match
}
None => false,
}
};
in_ids || in_selectors
}