Implement `PartialEq` for `OptionSet` (#14765)

Closes https://github.com/astral-sh/uv/issues/14737.
This commit is contained in:
Charlie Marsh 2025-07-20 18:17:07 -04:00 committed by GitHub
parent 9923f42c2e
commit 5e2047b253
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -69,12 +69,20 @@ impl Display for OptionEntry {
///
/// It extracts the options by calling the [`OptionsMetadata::record`] of a type implementing
/// [`OptionsMetadata`].
#[derive(Copy, Clone, Eq, PartialEq)]
#[derive(Copy, Clone)]
pub struct OptionSet {
record: fn(&mut dyn Visit),
doc: fn() -> Option<&'static str>,
}
impl PartialEq for OptionSet {
fn eq(&self, other: &Self) -> bool {
std::ptr::fn_addr_eq(self.record, other.record) && std::ptr::fn_addr_eq(self.doc, other.doc)
}
}
impl Eq for OptionSet {}
impl OptionSet {
pub fn of<T>() -> Self
where