layout: Remove TryFrom<Contents> for NonReplacedContents (#37815)

This implementation is quite confusing as it makes it harder to tell
that we are just looking for the case that `Contents` contains
`NonReplacedContents`.

Testing: This shouldn't have any functional change, so is covered by
existing tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-07-01 20:21:33 +02:00 committed by GitHub
parent e0af75f265
commit 7375d09887
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 55 additions and 77 deletions

View file

@ -376,19 +376,6 @@ impl From<NonReplacedContents> for Contents {
}
}
impl std::convert::TryFrom<Contents> for NonReplacedContents {
type Error = &'static str;
fn try_from(contents: Contents) -> Result<Self, Self::Error> {
match contents {
Contents::NonReplaced(non_replaced_contents) => Ok(non_replaced_contents),
Contents::Replaced(_) => {
Err("Tried to covnert a `Contents::Replaced` into `NonReplacedContent`")
},
}
}
}
impl NonReplacedContents {
pub(crate) fn traverse<'dom>(
self,