feat: adjusted lint restrictions (#31)
This commit is contained in:
@@ -19,12 +19,12 @@ pub(crate) struct ByteHash {
|
||||
impl Hasher for ByteHash {
|
||||
#[inline]
|
||||
fn finish(&self) -> u64 {
|
||||
self.byte as u64
|
||||
u64::from(self.byte)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn write(&mut self, _: &[u8]) {
|
||||
unreachable!()
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
@@ -17,7 +17,7 @@ impl CompactVec {
|
||||
}
|
||||
|
||||
pub(crate) fn push(&mut self, num: f64) {
|
||||
self.push_n(num, 1)
|
||||
self.push_n(num, 1);
|
||||
}
|
||||
|
||||
pub(crate) fn push_n(&mut self, num: f64, n: usize) {
|
||||
@@ -28,7 +28,7 @@ impl CompactVec {
|
||||
{
|
||||
last.count += n;
|
||||
} else if n > 0 {
|
||||
self.inner.push(Entry::new(num, n))
|
||||
self.inner.push(Entry::new(num, n));
|
||||
}
|
||||
|
||||
self.len += n;
|
||||
@@ -38,7 +38,7 @@ impl CompactVec {
|
||||
where
|
||||
F: FnMut(f64) -> bool,
|
||||
{
|
||||
self.inner.retain(|entry| f(entry.value))
|
||||
self.inner.retain(|entry| f(entry.value));
|
||||
}
|
||||
|
||||
pub(crate) fn iter(&self) -> Iter<'_> {
|
||||
@@ -69,7 +69,7 @@ struct Entry {
|
||||
}
|
||||
|
||||
impl Entry {
|
||||
fn new(value: f64, count: usize) -> Self {
|
||||
const fn new(value: f64, count: usize) -> Self {
|
||||
Self { value, count }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,18 +51,18 @@ impl<T, const N: usize> LimitedQueue<T, N> {
|
||||
pub(crate) fn push(&mut self, elem: T) {
|
||||
self.end = (self.end + 1) % N;
|
||||
self.queue[self.end] = elem;
|
||||
self.len += (self.len < N) as usize;
|
||||
self.len += usize::from(self.len < N);
|
||||
}
|
||||
|
||||
pub(crate) fn is_empty(&self) -> bool {
|
||||
pub(crate) const fn is_empty(&self) -> bool {
|
||||
self.len == 0
|
||||
}
|
||||
|
||||
pub(crate) fn len(&self) -> usize {
|
||||
pub(crate) const fn len(&self) -> usize {
|
||||
self.len
|
||||
}
|
||||
|
||||
pub(crate) fn last(&self) -> Option<&T> {
|
||||
pub(crate) const fn last(&self) -> Option<&T> {
|
||||
if self.is_empty() {
|
||||
None
|
||||
} else {
|
||||
@@ -74,7 +74,7 @@ impl<T, const N: usize> LimitedQueue<T, N> {
|
||||
self.queue
|
||||
.iter()
|
||||
.cycle()
|
||||
.skip((self.len == N) as usize * (self.end + 1))
|
||||
.skip(usize::from(self.len == N) * (self.end + 1))
|
||||
.take(self.len)
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ impl<T, const N: usize> Index<usize> for LimitedQueue<T, N> {
|
||||
self.len
|
||||
);
|
||||
|
||||
let idx = (idx + (self.len == N) as usize * (self.end + 1)) % N;
|
||||
let idx = (idx + usize::from(self.len == N) * (self.end + 1)) % N;
|
||||
|
||||
&self.queue[idx]
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ impl<'map, E> From<&'map Beatmap> for MapOrElse<MapRef<'map>, E> {
|
||||
pub(crate) struct MapRef<'map>(&'map Beatmap);
|
||||
|
||||
impl<'map> MapRef<'map> {
|
||||
pub(crate) fn into_inner(self) -> &'map Beatmap {
|
||||
pub(crate) const fn into_inner(self) -> &'map Beatmap {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,13 +62,13 @@ impl TandemSorter {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn idx_is_marked(idx: usize) -> bool {
|
||||
const fn idx_is_marked(idx: usize) -> bool {
|
||||
// Check if first bit is set
|
||||
idx.leading_zeros() == 0
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn toggle_mark_idx(idx: usize) -> usize {
|
||||
const fn toggle_mark_idx(idx: usize) -> usize {
|
||||
// Flip the first bit
|
||||
idx ^ !(usize::MAX >> 1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user