Enable and fix several more clippy lints.

This commit is contained in:
Dan Gohman
2018-04-02 08:48:06 -07:00
parent 5c6cb202d8
commit bf597b7abf
71 changed files with 360 additions and 219 deletions

View File

@@ -18,8 +18,8 @@ pub struct Encoding {
impl Encoding {
/// Create a new `Encoding` containing `(recipe, bits)`.
pub fn new(recipe: u16, bits: u16) -> Encoding {
Encoding { recipe, bits }
pub fn new(recipe: u16, bits: u16) -> Self {
Self { recipe, bits }
}
/// Get the recipe number in this encoding.
@@ -122,10 +122,10 @@ impl EncInfo {
///
/// Returns 0 for illegal encodings.
pub fn bytes(&self, enc: Encoding) -> CodeOffset {
self.sizing
.get(enc.recipe())
.map(|s| CodeOffset::from(s.bytes))
.unwrap_or(0)
self.sizing.get(enc.recipe()).map_or(
0,
|s| CodeOffset::from(s.bytes),
)
}
/// Get the branch range that is supported by `enc`, if any.