Skip to content

Commit 2b19b49

Browse files
authored
Merge pull request #2180 from CosmWasm/co/cleanup
Various cleanup
2 parents 7b0d0c7 + 2b4d9fc commit 2b19b49

File tree

18 files changed

+41
-43
lines changed

18 files changed

+41
-43
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.
File renamed without changes.
File renamed without changes.

contracts/floaty/src/floats.rs

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -126,54 +126,54 @@ pub fn random_subnormal_64(rng: &mut impl RngCore) -> u64 {
126126
}
127127
}
128128

129-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
130-
pub enum Class {
131-
Normal,
132-
Subnormal,
133-
Zero,
134-
Infinite,
135-
NaN,
136-
}
129+
#[cfg(test)]
130+
mod tests {
131+
use rand_chacha::rand_core::SeedableRng;
137132

138-
pub trait Classifier {
139-
fn classify(&self) -> Class;
140-
}
133+
use super::*;
141134

142-
impl Classifier for u32 {
143-
fn classify(&self) -> Class {
144-
let exponent = self & EXPONENT_MASK_32;
145-
let mantissa = self & MANTISSA_MASK_32;
146-
147-
match (exponent, mantissa) {
148-
(0, 0) => Class::Zero,
149-
(0, _) => Class::Subnormal,
150-
(EXPONENT_MASK_32, 0) => Class::Infinite,
151-
(EXPONENT_MASK_32, _) => Class::NaN,
152-
_ => Class::Normal,
153-
}
135+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
136+
pub enum Class {
137+
Normal,
138+
Subnormal,
139+
Zero,
140+
Infinite,
141+
NaN,
154142
}
155-
}
156143

157-
impl Classifier for u64 {
158-
fn classify(&self) -> Class {
159-
let exponent = self & EXPONENT_MASK_64;
160-
let mantissa = self & MANTISSA_MASK_64;
161-
162-
match (exponent, mantissa) {
163-
(0, 0) => Class::Zero,
164-
(0, _) => Class::Subnormal,
165-
(EXPONENT_MASK_64, 0) => Class::Infinite,
166-
(EXPONENT_MASK_64, _) => Class::NaN,
167-
_ => Class::Normal,
168-
}
144+
pub trait Classifier {
145+
fn classify(&self) -> Class;
169146
}
170-
}
171147

172-
#[cfg(test)]
173-
mod tests {
174-
use rand_chacha::rand_core::SeedableRng;
148+
impl Classifier for u32 {
149+
fn classify(&self) -> Class {
150+
let exponent = self & EXPONENT_MASK_32;
151+
let mantissa = self & MANTISSA_MASK_32;
152+
153+
match (exponent, mantissa) {
154+
(0, 0) => Class::Zero,
155+
(0, _) => Class::Subnormal,
156+
(EXPONENT_MASK_32, 0) => Class::Infinite,
157+
(EXPONENT_MASK_32, _) => Class::NaN,
158+
_ => Class::Normal,
159+
}
160+
}
161+
}
175162

176-
use super::*;
163+
impl Classifier for u64 {
164+
fn classify(&self) -> Class {
165+
let exponent = self & EXPONENT_MASK_64;
166+
let mantissa = self & MANTISSA_MASK_64;
167+
168+
match (exponent, mantissa) {
169+
(0, 0) => Class::Zero,
170+
(0, _) => Class::Subnormal,
171+
(EXPONENT_MASK_64, 0) => Class::Infinite,
172+
(EXPONENT_MASK_64, _) => Class::NaN,
173+
_ => Class::Normal,
174+
}
175+
}
176+
}
177177

178178
#[test]
179179
fn test_constants() {

0 commit comments

Comments
 (0)