clippy saves the day part 4
parent
b33dc356c4
commit
8d504612cb
|
@ -383,7 +383,7 @@ impl OptU16
|
||||||
///
|
///
|
||||||
/// assert_eq!(OptU16::none(), OptU16::from_repr(u16::max_value()));
|
/// 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`.
|
/// Creates an `OptU16` from a `u16`.
|
||||||
pub fn from_repr(n: u16) -> Self
|
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(u16max).get_repr(), u16max);
|
||||||
/// assert_eq!(OptU16::from_repr(0u16).get_repr(), 0u16);
|
/// assert_eq!(OptU16::from_repr(0u16).get_repr(), 0u16);
|
||||||
/// ```
|
/// ```
|
||||||
pub fn get_repr(&self) -> u16
|
pub fn get_repr(self) -> u16
|
||||||
{
|
{
|
||||||
match self.0 {
|
match self.0 {
|
||||||
None => u16::max_value(),
|
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(u16::max_value()).get(), None);
|
||||||
/// assert_eq!(OptU16::from_repr(0u16).get(), Some(0u16));
|
/// assert_eq!(OptU16::from_repr(0u16).get(), Some(0u16));
|
||||||
/// ```
|
/// ```
|
||||||
pub fn get(&self) -> Option<u16>
|
pub fn get(self) -> Option<u16>
|
||||||
{
|
{
|
||||||
match self.0 {
|
match self.0 {
|
||||||
None => None,
|
None => None,
|
||||||
|
|
|
@ -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 first_bits = cr_ptr as u32 % 8;
|
||||||
let last_bits = nx_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;
|
let num_bytes = last_byte - first_byte;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
//! Fixed point numbers.
|
//! Fixed point numbers.
|
||||||
|
#![allow(clippy::use_self)]
|
||||||
|
|
||||||
use std::{fmt::{self, Write}, ops::*};
|
use std::{fmt::{self, Write}, ops::*};
|
||||||
|
|
||||||
|
|
|
@ -499,7 +499,7 @@ impl Default for Minf
|
||||||
{
|
{
|
||||||
fn default() -> Self
|
fn default() -> Self
|
||||||
{
|
{
|
||||||
Minf{texture_id: 0,
|
Self{texture_id: 0,
|
||||||
physics_id: 1,
|
physics_id: 1,
|
||||||
skypict_id: 0,
|
skypict_id: 0,
|
||||||
miss_flags: MsnFlags::empty(),
|
miss_flags: MsnFlags::empty(),
|
||||||
|
|
|
@ -286,7 +286,7 @@ impl Color for ColorShp
|
||||||
{
|
{
|
||||||
match *self {
|
match *self {
|
||||||
ColorShp::Translucent => 0,
|
ColorShp::Translucent => 0,
|
||||||
ColorShp::Opaque{r, ..} => r,
|
ColorShp::Opaque{r, ..} |
|
||||||
ColorShp::Lit {r, ..} => r,
|
ColorShp::Lit {r, ..} => r,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ impl Color for ColorShp
|
||||||
{
|
{
|
||||||
match *self {
|
match *self {
|
||||||
ColorShp::Translucent => 0,
|
ColorShp::Translucent => 0,
|
||||||
ColorShp::Opaque{g, ..} => g,
|
ColorShp::Opaque{g, ..} |
|
||||||
ColorShp::Lit {g, ..} => g,
|
ColorShp::Lit {g, ..} => g,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,7 @@ impl Color for ColorShp
|
||||||
{
|
{
|
||||||
match *self {
|
match *self {
|
||||||
ColorShp::Translucent => 0,
|
ColorShp::Translucent => 0,
|
||||||
ColorShp::Opaque{b, ..} => b,
|
ColorShp::Opaque{b, ..} |
|
||||||
ColorShp::Lit {b, ..} => b,
|
ColorShp::Lit {b, ..} => b,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ impl Color for ColorShp
|
||||||
{
|
{
|
||||||
match *self {
|
match *self {
|
||||||
ColorShp::Translucent => 0,
|
ColorShp::Translucent => 0,
|
||||||
ColorShp::Opaque{..} => u16::max_value(),
|
ColorShp::Opaque{..} |
|
||||||
ColorShp::Lit {..} => u16::max_value(),
|
ColorShp::Lit {..} => u16::max_value(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue