Diffstat (limited to 'src/symbol.rs')
-rw-r--r--src/symbol.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/symbol.rs b/src/symbol.rs
index e5d984f..1809897 100644
--- a/src/symbol.rs
+++ b/src/symbol.rs
@@ -10,7 +10,7 @@ use range::*;
/// Unique symbol, given a unique tag.
///
/// ```
-/// use uniserde::symbol::Symbol;
+/// use treaty::symbol::Symbol;
///
/// const PROPERTY: Symbol = Symbol::new("Property");
/// # let _ = PROPERTY;
@@ -78,7 +78,7 @@ impl Symbol {
/// This is provided to allow using a [`Symbol`] as a const generic.
///
/// ```
- /// use uniserde::symbol::Symbol;
+ /// use treaty::symbol::Symbol;
///
/// struct MyType<const N: u64>;
///
@@ -210,6 +210,7 @@ fn decode(input: u64, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut offset = 0;
// Read a bit to fill the precision.
+ #[allow(clippy::mut_range_bound)]
for _ in 0..precision {
input_buffer = (input_buffer << 1)
| match bit(&mut precision, &mut offset, input) {
@@ -755,6 +756,7 @@ mod test {
}
#[test]
+ #[allow(clippy::approx_constant)]
fn alphabet() {
// This test is special. It generates the model table from a set
// of basic probability lists. If the table in the code is wrong
@@ -790,7 +792,7 @@ mod test {
('z', 0.07),
]);
assert_eq!(lower.len(), 26);
- assert!((lower.iter().map(|(_, x)| x).sum::<f64>() - 100.0).abs() < 0.1);
+ assert!((lower.values().sum::<f64>() - 100.0).abs() < 0.1);
let upper = HashMap::<char, f64>::from([
('A', 5.64),
@@ -821,7 +823,7 @@ mod test {
('Z', 0.27),
]);
assert_eq!(upper.len(), 26);
- assert!((upper.iter().map(|(_, x)| x).sum::<f64>() - 100.0).abs() < 0.1);
+ assert!((upper.values().sum::<f64>() - 100.0).abs() < 0.1);
let digit = HashMap::<char, f64>::from([
('1', 30.1),
@@ -836,11 +838,11 @@ mod test {
('0', 1.0),
]);
assert_eq!(digit.len(), 10);
- assert!((digit.iter().map(|(_, x)| x).sum::<f64>() - 100.0).abs() < 0.1);
+ assert!((digit.values().sum::<f64>() - 100.0).abs() < 0.1);
let extra = HashMap::<char, f64>::from([(' ', 30.0), ('_', 60.0), ('-', 10.0)]);
assert_eq!(extra.len(), 3);
- assert!((extra.iter().map(|(_, x)| x).sum::<f64>() - 100.0).abs() < 0.1);
+ assert!((extra.values().sum::<f64>() - 100.0).abs() < 0.1);
let all: HashMap<char, f64> = lower
.iter()
@@ -897,6 +899,7 @@ mod test {
// This is the model used in the arithmetic coding.
#[rustfmt::skip]
+#[allow(clippy::items_after_test_module)]
const ALPHABET: &[(u8, [(u64, u64); 18])] = &[
(b' ', [(0,1180),(0,1178),(0,1168),(0,1153),(0,1123),(0,1092),(0,1058),(0,1020),(0,980),(0,935),(0,885),(0,828),(0,763),(0,685),(0,590),(0,468),(0,0),(0,0),]),
(b'-', [(1180,393),(1178,393),(1168,389),(1153,384),(1123,374),(1092,364),(1058,353),(1020,340),(980,327),(935,312),(885,295),(828,276),(763,254),(685,228),(590,197),(468,156),(0,0),(0,0),]),