-
-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Total sort order for redactions #587
Comments
From this code? #[cfg_attr(docsrs, doc(cfg(feature = "redactions")))]
pub fn sorted_redaction() -> Redaction {
fn sort(mut value: Content, _path: ContentPath) -> Content {
match value.resolve_inner_mut() {
Content::Seq(ref mut val) => {
val.sort_by(|a, b| a.partial_cmp(b).unwrap_or(std::cmp::Ordering::Equal))
}
Content::Map(ref mut val) => {
val.sort_by(|a, b| a.partial_cmp(b).unwrap_or(std::cmp::Ordering::Equal))
}
Content::Struct(_, ref mut fields)
| Content::StructVariant(_, _, _, ref mut fields) => {
fields.sort_by(|a, b| a.partial_cmp(b).unwrap_or(std::cmp::Ordering::Equal))
}
_ => {}
}
value
}
dynamic_redaction(sort)
} I don't feel confident here, but what's the case for this not being a total order? That |
It would be for floats containing NaNs in vectors. |
OK, I had thought those consistently evaluate to |
Followup to #586 there is another case in the redaction code that is most likely also wrong. It pairs
sort_by
withunwrap_or
.The text was updated successfully, but these errors were encountered: