Skip to content

Commit

Permalink
Introduce Clippy, and follow its suggestions
Browse files Browse the repository at this point in the history
Actually, don't follow its suggestion about the code point literals
being unreadable.
  • Loading branch information
nuew committed Dec 18, 2017
1 parent abcf73e commit 3d26a59
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ default = ["fnv"]
nightly = []

[dependencies]
clippy = { version = "*", optional = true }
fnv = { version = "1", optional = true }
lazy_static = "1"
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//!
//! [1]: https://github.com/qntm/base65536
//! [2]: https://crates.io/crates/base64
#![cfg_attr(feature = "clippy", feature(plugin))]
#![cfg_attr(feature = "clippy", plugin(clippy))]
#![cfg_attr(feature = "nightly" , feature(test))]

#[macro_use]
Expand All @@ -26,7 +28,8 @@ use fnv::FnvBuildHasher as Hasher;
use std::collections::hash_map::RandomState as Hasher;

const PADDING_BLOCK_START: u32 = 0x1500;
const BLOCK_STARTS: &'static [u32] =
#[cfg_attr(feature = "clippy", allow(unreadable_literal))]
const BLOCK_STARTS: &[u32] =
&[0x03400, 0x03500, 0x03600, 0x03700, 0x03800, 0x03900, 0x03A00, 0x03B00, 0x03C00, 0x03D00,
0x03E00, 0x03F00, 0x04000, 0x04100, 0x04200, 0x04300, 0x04400, 0x04500, 0x04600, 0x04700,
0x04800, 0x04900, 0x04A00, 0x04B00, 0x04C00, 0x04E00, 0x04F00, 0x05000, 0x05100, 0x05200,
Expand Down Expand Up @@ -213,7 +216,7 @@ pub fn encode_buf<T: ?Sized + AsRef<[u8]>>(input: &T,
} else {
PADDING_BLOCK_START
};
let code_point = block_start + byte1 as u32;
let code_point = block_start + u32::from(byte1);

// output wrap if requested
if let Some((column, eol)) = wrap {
Expand Down

0 comments on commit 3d26a59

Please sign in to comment.