refactor: remove is_compatible_with

This commit is contained in:
daimond113 2024-09-27 14:14:42 +02:00
parent 10c804e2f3
commit bc86c2f1c5
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C
2 changed files with 1 additions and 21 deletions

View file

@ -72,24 +72,6 @@ impl TargetKind {
TargetKind::Luau,
];
/// Whether this target is compatible with another target
/// self is the project's target, dependency is the target of the dependency
pub fn is_compatible_with(&self, dependency: &Self) -> bool {
if self == dependency {
return true;
}
match (self, dependency) {
#[cfg(all(feature = "lune", feature = "luau"))]
(TargetKind::Lune, TargetKind::Luau) => true,
#[cfg(feature = "roblox")]
(TargetKind::RobloxServer, TargetKind::Roblox) => true,
_ => false,
}
}
/// The folder to store packages in for this target
/// self is the project's target, dependency is the target of the dependency
pub fn packages_folder(&self, dependency: &Self) -> String {

View file

@ -219,9 +219,7 @@ impl PackageSource for PesdePackageSource {
.into_iter()
.filter(|(VersionId(version, target), _)| {
specifier.version.matches(version)
&& specifier
.target
.map_or(package_target.is_compatible_with(target), |t| t == *target)
&& specifier.target.unwrap_or(package_target) == *target
})
.map(|(id, entry)| {
let version = id.version().clone();