clippy saves the day part 4

png-branch
an 2019-03-09 17:48:55 -05:00
parent b33dc356c4
commit 8d504612cb
5 changed files with 10 additions and 9 deletions

View File

@ -383,7 +383,7 @@ impl OptU16
///
/// assert_eq!(OptU16::none(), OptU16::from_repr(u16::max_value()));
/// ```
pub const fn none() -> Self {OptU16(None)}
pub const fn none() -> Self {Self(None)}
/// Creates an `OptU16` from a `u16`.
pub fn from_repr(n: u16) -> Self
@ -408,7 +408,7 @@ impl OptU16
/// assert_eq!(OptU16::from_repr(u16max).get_repr(), u16max);
/// assert_eq!(OptU16::from_repr(0u16).get_repr(), 0u16);
/// ```
pub fn get_repr(&self) -> u16
pub fn get_repr(self) -> u16
{
match self.0 {
None => u16::max_value(),
@ -427,7 +427,7 @@ impl OptU16
/// assert_eq!(OptU16::from_repr(u16::max_value()).get(), None);
/// assert_eq!(OptU16::from_repr(0u16).get(), Some(0u16));
/// ```
pub fn get(&self) -> Option<u16>
pub fn get(self) -> Option<u16>
{
match self.0 {
None => None,

View File

@ -27,7 +27,7 @@ pub fn read_bits(b: &[u8], cr_ptr: usize, width: u8) -> ResultS<(usize, u64)>
let first_bits = cr_ptr as u32 % 8;
let last_bits = nx_ptr as u32 % 8;
let last_mask = ((1u128 << last_bits) - 1) as u64;
let last_mask = ((1_u128 << last_bits) - 1) as u64;
let num_bytes = last_byte - first_byte;

View File

@ -1,4 +1,5 @@
//! Fixed point numbers.
#![allow(clippy::use_self)]
use std::{fmt::{self, Write}, ops::*};

View File

@ -499,7 +499,7 @@ impl Default for Minf
{
fn default() -> Self
{
Minf{texture_id: 0,
Self{texture_id: 0,
physics_id: 1,
skypict_id: 0,
miss_flags: MsnFlags::empty(),

View File

@ -286,7 +286,7 @@ impl Color for ColorShp
{
match *self {
ColorShp::Translucent => 0,
ColorShp::Opaque{r, ..} => r,
ColorShp::Opaque{r, ..} |
ColorShp::Lit {r, ..} => r,
}
}
@ -295,7 +295,7 @@ impl Color for ColorShp
{
match *self {
ColorShp::Translucent => 0,
ColorShp::Opaque{g, ..} => g,
ColorShp::Opaque{g, ..} |
ColorShp::Lit {g, ..} => g,
}
}
@ -304,7 +304,7 @@ impl Color for ColorShp
{
match *self {
ColorShp::Translucent => 0,
ColorShp::Opaque{b, ..} => b,
ColorShp::Opaque{b, ..} |
ColorShp::Lit {b, ..} => b,
}
}
@ -313,7 +313,7 @@ impl Color for ColorShp
{
match *self {
ColorShp::Translucent => 0,
ColorShp::Opaque{..} => u16::max_value(),
ColorShp::Opaque{..} |
ColorShp::Lit {..} => u16::max_value(),
}
}