toolchains: Do not use as_json representation for PartialEq (#21682)

Closes #21679

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-12-07 14:52:55 +01:00 committed by GitHub
parent f561a91daf
commit fdc7751457
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -14,7 +14,7 @@ use settings::WorktreeId;
use crate::LanguageName; use crate::LanguageName;
/// Represents a single toolchain. /// Represents a single toolchain.
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug)]
pub struct Toolchain { pub struct Toolchain {
/// User-facing label /// User-facing label
pub name: SharedString, pub name: SharedString,
@ -24,6 +24,18 @@ pub struct Toolchain {
pub as_json: serde_json::Value, pub as_json: serde_json::Value,
} }
impl PartialEq for Toolchain {
fn eq(&self, other: &Self) -> bool {
// Do not use as_json for comparisons; it shouldn't impact equality, as it's not user-surfaced.
// Thus, there could be multiple entries that look the same in the UI.
(&self.name, &self.path, &self.language_name).eq(&(
&other.name,
&other.path,
&other.language_name,
))
}
}
#[async_trait] #[async_trait]
pub trait ToolchainLister: Send + Sync { pub trait ToolchainLister: Send + Sync {
async fn list( async fn list(