Skip to content

Commit ff85195

Browse files
committed
finish fixing clippy lints, add changelog
and codegolf
1 parent 8fc5cea commit ff85195

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ Documentation
5353
Changelog
5454
---------
5555

56+
* to be released
57+
- Switch to 2021 edition.
58+
5659
* 0.6.1
5760
- Fix deprecation warning and remove `#[deny(warnings)]` (a future
5861
compatibility hazard in libraries).

src/lib.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
#![deny(missing_docs)]
6262
#![deny(missing_debug_implementations)]
6363
#![warn(clippy::pedantic)]
64+
#![allow(clippy::manual_let_else)]
6465

6566
use std::borrow::Borrow;
6667
use std::cmp;
@@ -229,12 +230,7 @@ impl<K: Ord + Clone> Book<K> {
229230
K: Borrow<Q>,
230231
Q: Ord,
231232
{
232-
match self.book.get(k) {
233-
Some(code) => buffer.extend(code),
234-
None => return Err(EncodeError {}),
235-
}
236-
237-
Ok(())
233+
self.book.get(k).map(|code| buffer.extend(code)).ok_or(EncodeError {})
238234
}
239235

240236
fn new() -> Book<K> {
@@ -422,7 +418,7 @@ impl<'a, K: Ord + Clone, W: Saturating + Ord + Clone> FromIterator<(&'a K, &'a W
422418
where
423419
T: IntoIterator<Item = (&'a K, &'a W)>,
424420
{
425-
CodeBuilder::from_iter(weights.into_iter().map(|(k, v)| (k.clone(), v.clone())))
421+
weights.into_iter().map(|(k, v)| (k.clone(), v.clone())).collect()
426422
}
427423
}
428424

@@ -554,7 +550,7 @@ mod tests {
554550
};
555551

556552
at >= ct || len("CT") <= len("AT") ||
557-
ag.saturating_add(at).saturating_add(cg).saturating_add(ct).saturating_add(tg) >= u32::MAX
553+
ag.saturating_add(at).saturating_add(cg).saturating_add(ct).saturating_add(tg) == u32::MAX
558554
}
559555

560556
fn encode_decode_bytes(symbols: Vec<u8>) -> bool {

0 commit comments

Comments
 (0)