mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
check is_public vs Kind more carefully
This commit is contained in:
parent
034c5908d8
commit
cb95f5ef7c
@ -328,6 +328,10 @@ impl Dependency {
|
||||
}
|
||||
|
||||
pub fn set_kind(&mut self, kind: Kind) -> &mut Dependency {
|
||||
if self.is_public() {
|
||||
// Setting 'public' only makes sense for normal dependencies
|
||||
assert_eq!(kind, Kind::Normal);
|
||||
}
|
||||
Rc::make_mut(&mut self.inner).kind = kind;
|
||||
self
|
||||
}
|
||||
|
@ -49,19 +49,11 @@ impl Resolve {
|
||||
.map(|p| {
|
||||
let public_deps = graph
|
||||
.edges(p)
|
||||
.flat_map(|(dep_package, deps)| {
|
||||
let id_opt: Option<PackageId> = deps
|
||||
.iter()
|
||||
.find(|d| d.kind() == Kind::Normal)
|
||||
.and_then(|d| {
|
||||
if d.is_public() {
|
||||
Some(*dep_package)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
id_opt
|
||||
.filter(|(_, deps)| {
|
||||
deps.iter()
|
||||
.any(|d| d.kind() == Kind::Normal && d.is_public())
|
||||
})
|
||||
.map(|(dep_package, _)| *dep_package)
|
||||
.collect::<HashSet<PackageId>>();
|
||||
|
||||
(*p, public_deps)
|
||||
|
Loading…
x
Reference in New Issue
Block a user