mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
remove usage of legacy numeric operations in script (#33095)
These operations are deprecated and might be removed in a future rust version. Clippy is also complaining about them. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
09cac6430b
commit
f0045a7686
4 changed files with 8 additions and 11 deletions
|
@ -25,7 +25,7 @@ pub trait CollectionFilter: JSTraceable {
|
|||
fn filter<'a>(&self, elem: &'a Element, root: &'a Node) -> bool;
|
||||
}
|
||||
|
||||
/// An optional u32, using maxint to represent None.
|
||||
/// An optional u32, using u32::MAX to represent None.
|
||||
/// It would be nicer just to use Option<u32> for this, but that would produce word
|
||||
/// alignment issues since Option<u32> uses 33 bits.
|
||||
#[derive(Clone, Copy, JSTraceable, MallocSizeOf)]
|
||||
|
@ -35,7 +35,7 @@ struct OptionU32 {
|
|||
|
||||
impl OptionU32 {
|
||||
fn to_option(self) -> Option<u32> {
|
||||
if self.bits == u32::max_value() {
|
||||
if self.bits == u32::MAX {
|
||||
None
|
||||
} else {
|
||||
Some(self.bits)
|
||||
|
@ -43,14 +43,12 @@ impl OptionU32 {
|
|||
}
|
||||
|
||||
fn some(bits: u32) -> OptionU32 {
|
||||
assert_ne!(bits, u32::max_value());
|
||||
assert_ne!(bits, u32::MAX);
|
||||
OptionU32 { bits }
|
||||
}
|
||||
|
||||
fn none() -> OptionU32 {
|
||||
OptionU32 {
|
||||
bits: u32::max_value(),
|
||||
}
|
||||
OptionU32 { bits: u32::MAX }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue