enforce lint groups
added remaining lint enforcements
This commit is contained in:
@@ -55,7 +55,7 @@ impl Movement {
|
||||
self.current_section_peak = self.peak_strain(time - self.prev_time.unwrap());
|
||||
}
|
||||
|
||||
pub(crate) fn process(&mut self, current: &DifficultyObject) {
|
||||
pub(crate) fn process(&mut self, current: &DifficultyObject<'_>) {
|
||||
self.current_strain *= strain_decay(current.delta);
|
||||
self.current_strain += self.strain_value_of(current) * SKILL_MULTIPLIER;
|
||||
self.current_section_peak = self.current_strain.max(self.current_section_peak);
|
||||
@@ -77,7 +77,7 @@ impl Movement {
|
||||
difficulty
|
||||
}
|
||||
|
||||
fn strain_value_of(&mut self, current: &DifficultyObject) -> f32 {
|
||||
fn strain_value_of(&mut self, current: &DifficultyObject<'_>) -> f32 {
|
||||
let last_player_pos = self
|
||||
.last_player_position
|
||||
.unwrap_or(current.last_normalized_pos);
|
||||
|
||||
+6
-5
@@ -134,6 +134,7 @@
|
||||
//! - \[x\] async parsing
|
||||
|
||||
#![cfg_attr(docsrs, feature(doc_cfg), deny(broken_intra_doc_links))]
|
||||
#![deny(clippy::all, nonstandard_style, rust_2018_idioms, unused, warnings)]
|
||||
|
||||
#[cfg(feature = "fruits")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "fruits")))]
|
||||
@@ -194,7 +195,7 @@ pub trait BeatmapExt {
|
||||
/// Returns a builder to calculate pp and difficulty values.
|
||||
///
|
||||
/// Convenient method that matches on the map's mode to choose the appropriate calculator.
|
||||
fn pp(&self) -> AnyPP;
|
||||
fn pp(&self) -> AnyPP<'_>;
|
||||
|
||||
/// Calculate the strains of a map.
|
||||
/// This essentially performs the same calculation as a `stars` function but
|
||||
@@ -253,7 +254,7 @@ impl BeatmapExt for Beatmap {
|
||||
}
|
||||
GameMode::TKO => {
|
||||
#[cfg(not(feature = "taiko"))]
|
||||
panic!("`osu` feature is not enabled");
|
||||
panic!("`taiko` feature is not enabled");
|
||||
|
||||
#[cfg(feature = "taiko")]
|
||||
StarResult::Taiko(taiko::stars(self, mods, passed_objects))
|
||||
@@ -286,7 +287,7 @@ impl BeatmapExt for Beatmap {
|
||||
}
|
||||
GameMode::TKO => {
|
||||
#[cfg(not(feature = "taiko"))]
|
||||
panic!("`osu` feature is not enabled");
|
||||
panic!("`taiko` feature is not enabled");
|
||||
|
||||
#[cfg(feature = "taiko")]
|
||||
PpResult::Taiko(TaikoPP::new(self).mods(mods).calculate())
|
||||
@@ -302,7 +303,7 @@ impl BeatmapExt for Beatmap {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn pp(&self) -> AnyPP {
|
||||
fn pp(&self) -> AnyPP<'_> {
|
||||
AnyPP::new(self)
|
||||
}
|
||||
|
||||
@@ -350,7 +351,7 @@ impl BeatmapExt for Beatmap {
|
||||
}
|
||||
GameMode::TKO => {
|
||||
#[cfg(not(feature = "taiko"))]
|
||||
panic!("`osu` feature is not enabled");
|
||||
panic!("`taiko` feature is not enabled");
|
||||
|
||||
#[cfg(feature = "taiko")]
|
||||
taiko::strains(self, mods)
|
||||
|
||||
+2
-2
@@ -63,14 +63,14 @@ impl Strain {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn process(&mut self, current: &DifficultyHitObject) {
|
||||
pub(crate) fn process(&mut self, current: &DifficultyHitObject<'_>) {
|
||||
self.current_strain *= self.strain_decay(current.delta);
|
||||
self.current_strain += self.strain_value_of(current) * SKILL_MULTIPLIER;
|
||||
self.current_section_peak = self.current_strain.max(self.current_section_peak);
|
||||
self.prev_time.replace(current.start_time);
|
||||
}
|
||||
|
||||
fn strain_value_of(&mut self, current: &DifficultyHitObject) -> f32 {
|
||||
fn strain_value_of(&mut self, current: &DifficultyHitObject<'_>) -> f32 {
|
||||
let end_time = current.base.end_time();
|
||||
|
||||
let mut hold_factor = 1.0;
|
||||
|
||||
@@ -42,7 +42,7 @@ pub(crate) struct ObjectParameters<'a> {
|
||||
|
||||
impl OsuObject {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) fn new(h: &HitObject, hr: bool, params: &mut ObjectParameters) -> Option<Self> {
|
||||
pub(crate) fn new(h: &HitObject, hr: bool, params: &mut ObjectParameters<'_>) -> Option<Self> {
|
||||
let ObjectParameters {
|
||||
map,
|
||||
radius,
|
||||
|
||||
@@ -31,7 +31,7 @@ impl Skill {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn process(&mut self, curr: &DifficultyObject) {
|
||||
pub(crate) fn process(&mut self, curr: &DifficultyObject<'_>) {
|
||||
self.kind.pre_process();
|
||||
self.curr_section_peak = self.strain_value_at(curr).max(self.curr_section_peak);
|
||||
self.prev_time = Some(curr.base.time);
|
||||
@@ -89,7 +89,7 @@ impl Skill {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn strain_value_at(&mut self, curr: &DifficultyObject) -> f32 {
|
||||
pub(crate) fn strain_value_at(&mut self, curr: &DifficultyObject<'_>) -> f32 {
|
||||
self.curr_strain *= self.kind.strain_decay(curr.delta);
|
||||
self.curr_strain += self.kind.strain_value_of(curr) * self.kind.skill_multiplier();
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ pub(crate) struct FlashlightHistoryEntry {
|
||||
}
|
||||
|
||||
impl From<&DifficultyObject<'_>> for FlashlightHistoryEntry {
|
||||
fn from(h: &DifficultyObject) -> Self {
|
||||
fn from(h: &DifficultyObject<'_>) -> Self {
|
||||
Self {
|
||||
end_pos: h.base.end_pos(),
|
||||
is_spinner: h.base.is_spinner(),
|
||||
@@ -62,7 +62,7 @@ pub(crate) struct SpeedHistoryEntry {
|
||||
}
|
||||
|
||||
impl From<&DifficultyObject<'_>> for SpeedHistoryEntry {
|
||||
fn from(h: &DifficultyObject) -> Self {
|
||||
fn from(h: &DifficultyObject<'_>) -> Self {
|
||||
Self {
|
||||
is_slider: h.base.is_slider(),
|
||||
start_time: h.base.time,
|
||||
@@ -108,7 +108,7 @@ impl SkillKind {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn post_process(&mut self, current: &DifficultyObject) {
|
||||
pub(crate) fn post_process(&mut self, current: &DifficultyObject<'_>) {
|
||||
match self {
|
||||
Self::Aim => {}
|
||||
Self::Flashlight { history, .. } => history.push_front(current.into()),
|
||||
@@ -116,7 +116,7 @@ impl SkillKind {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn strain_value_of(&self, curr: &DifficultyObject) -> f32 {
|
||||
pub(crate) fn strain_value_of(&self, curr: &DifficultyObject<'_>) -> f32 {
|
||||
match self {
|
||||
Self::Aim => {
|
||||
if curr.base.is_spinner() {
|
||||
@@ -286,7 +286,7 @@ impl SkillKind {
|
||||
}
|
||||
|
||||
pub(crate) fn calculate_speed_rhythm_bonus(
|
||||
current: &DifficultyObject,
|
||||
current: &DifficultyObject<'_>,
|
||||
history: &VecDeque<SpeedHistoryEntry>,
|
||||
hit_window: f32,
|
||||
) -> f32 {
|
||||
|
||||
@@ -37,7 +37,7 @@ pub(crate) struct ObjectParameters<'a> {
|
||||
}
|
||||
|
||||
impl OsuObject {
|
||||
pub(crate) fn new(h: &HitObject, params: &mut ObjectParameters) -> Option<Self> {
|
||||
pub(crate) fn new(h: &HitObject, params: &mut ObjectParameters<'_>) -> Option<Self> {
|
||||
let ObjectParameters {
|
||||
map,
|
||||
radius,
|
||||
|
||||
@@ -30,7 +30,7 @@ impl Skill {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn process(&mut self, curr: &DifficultyObject) {
|
||||
pub(crate) fn process(&mut self, curr: &DifficultyObject<'_>) {
|
||||
self.kind.pre_process();
|
||||
self.curr_section_peak = self.strain_value_at(curr).max(self.curr_section_peak);
|
||||
self.prev_time = Some(curr.base.time);
|
||||
@@ -88,7 +88,7 @@ impl Skill {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn strain_value_at(&mut self, curr: &DifficultyObject) -> f32 {
|
||||
pub(crate) fn strain_value_at(&mut self, curr: &DifficultyObject<'_>) -> f32 {
|
||||
self.curr_strain *= self.kind.strain_decay(curr.delta);
|
||||
self.curr_strain += self.kind.strain_value_of(curr) * self.kind.skill_multiplier();
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ pub(crate) struct FlashlightHistoryEntry {
|
||||
}
|
||||
|
||||
impl From<&DifficultyObject<'_>> for FlashlightHistoryEntry {
|
||||
fn from(h: &DifficultyObject) -> Self {
|
||||
fn from(h: &DifficultyObject<'_>) -> Self {
|
||||
Self {
|
||||
end_pos: h.base.end_pos(),
|
||||
is_spinner: h.base.is_spinner(),
|
||||
@@ -62,7 +62,7 @@ pub(crate) struct SpeedHistoryEntry {
|
||||
}
|
||||
|
||||
impl From<&DifficultyObject<'_>> for SpeedHistoryEntry {
|
||||
fn from(h: &DifficultyObject) -> Self {
|
||||
fn from(h: &DifficultyObject<'_>) -> Self {
|
||||
Self {
|
||||
is_slider: h.base.is_slider(),
|
||||
start_time: h.base.time,
|
||||
@@ -108,7 +108,7 @@ impl SkillKind {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn post_process(&mut self, current: &DifficultyObject) {
|
||||
pub(crate) fn post_process(&mut self, current: &DifficultyObject<'_>) {
|
||||
match self {
|
||||
Self::Aim => {}
|
||||
Self::Flashlight { history, .. } => history.push_front(current.into()),
|
||||
@@ -116,7 +116,7 @@ impl SkillKind {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn strain_value_of(&self, curr: &DifficultyObject) -> f32 {
|
||||
pub(crate) fn strain_value_of(&self, curr: &DifficultyObject<'_>) -> f32 {
|
||||
match self {
|
||||
Self::Aim => {
|
||||
if curr.base.is_spinner() {
|
||||
@@ -286,7 +286,7 @@ impl SkillKind {
|
||||
}
|
||||
|
||||
pub(crate) fn calculate_speed_rhythm_bonus(
|
||||
current: &DifficultyObject,
|
||||
current: &DifficultyObject<'_>,
|
||||
history: &VecDeque<SpeedHistoryEntry>,
|
||||
hit_window: f32,
|
||||
) -> f32 {
|
||||
|
||||
@@ -31,7 +31,7 @@ impl Skill {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn process(&mut self, curr: &DifficultyObject) {
|
||||
pub(crate) fn process(&mut self, curr: &DifficultyObject<'_>) {
|
||||
self.kind.pre_process();
|
||||
self.curr_section_peak = self.strain_value_at(curr).max(self.curr_section_peak);
|
||||
self.prev_time = Some(curr.base.time);
|
||||
@@ -89,7 +89,7 @@ impl Skill {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn strain_value_at(&mut self, curr: &DifficultyObject) -> f32 {
|
||||
pub(crate) fn strain_value_at(&mut self, curr: &DifficultyObject<'_>) -> f32 {
|
||||
self.curr_strain *= self.kind.strain_decay(curr.delta);
|
||||
self.curr_strain += self.kind.strain_value_of(curr) * self.kind.skill_multiplier();
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ pub(crate) struct FlashlightHistoryEntry {
|
||||
}
|
||||
|
||||
impl From<&DifficultyObject<'_>> for FlashlightHistoryEntry {
|
||||
fn from(h: &DifficultyObject) -> Self {
|
||||
fn from(h: &DifficultyObject<'_>) -> Self {
|
||||
Self {
|
||||
end_pos: h.base.pos,
|
||||
is_spinner: h.base.is_spinner,
|
||||
@@ -62,7 +62,7 @@ pub(crate) struct SpeedHistoryEntry {
|
||||
}
|
||||
|
||||
impl From<&DifficultyObject<'_>> for SpeedHistoryEntry {
|
||||
fn from(h: &DifficultyObject) -> Self {
|
||||
fn from(h: &DifficultyObject<'_>) -> Self {
|
||||
Self {
|
||||
is_slider: h.base.is_slider,
|
||||
start_time: h.base.time,
|
||||
@@ -108,7 +108,7 @@ impl SkillKind {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn post_process(&mut self, current: &DifficultyObject) {
|
||||
pub(crate) fn post_process(&mut self, current: &DifficultyObject<'_>) {
|
||||
match self {
|
||||
Self::Aim => {}
|
||||
Self::Flashlight { history, .. } => history.push_front(current.into()),
|
||||
@@ -116,7 +116,7 @@ impl SkillKind {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn strain_value_of(&self, curr: &DifficultyObject) -> f32 {
|
||||
pub(crate) fn strain_value_of(&self, curr: &DifficultyObject<'_>) -> f32 {
|
||||
match self {
|
||||
Self::Aim => {
|
||||
if curr.base.is_spinner {
|
||||
@@ -282,7 +282,7 @@ impl SkillKind {
|
||||
}
|
||||
|
||||
pub(crate) fn calculate_speed_rhythm_bonus(
|
||||
current: &DifficultyObject,
|
||||
current: &DifficultyObject<'_>,
|
||||
history: &VecDeque<SpeedHistoryEntry>,
|
||||
hit_window: f32,
|
||||
) -> f32 {
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ pub enum ParseError {
|
||||
}
|
||||
|
||||
impl fmt::Display for ParseError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::IOError(_) => f.write_str("IO error"),
|
||||
Self::IncorrectFileHeader => {
|
||||
|
||||
+3
-3
@@ -98,13 +98,13 @@ impl ops::AddAssign for Pos2 {
|
||||
}
|
||||
|
||||
impl fmt::Display for Pos2 {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{:?}", self)
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Debug::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for Pos2 {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "({}, {})", self.x, self.y)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ impl<T> LimitedQueue<T> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn iter(&self) -> LimitedQueueIter<T> {
|
||||
pub(crate) fn iter(&self) -> LimitedQueueIter<'_, T> {
|
||||
let iter = self
|
||||
.queue
|
||||
.iter()
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ impl Skill {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn process(&mut self, current: &DifficultyObject, cheese: &[bool]) {
|
||||
pub(crate) fn process(&mut self, current: &DifficultyObject<'_>, cheese: &[bool]) {
|
||||
self.current_strain *= self.strain_decay(current.delta);
|
||||
self.current_strain += self.kind.strain_value_of(current, cheese) * self.skill_multiplier();
|
||||
self.current_section_peak = self.current_section_peak.max(self.current_strain);
|
||||
|
||||
@@ -55,7 +55,11 @@ impl SkillKind {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn strain_value_of(&mut self, current: &DifficultyObject, cheese: &[bool]) -> f32 {
|
||||
pub(crate) fn strain_value_of(
|
||||
&mut self,
|
||||
current: &DifficultyObject<'_>,
|
||||
cheese: &[bool],
|
||||
) -> f32 {
|
||||
match self {
|
||||
Self::Color {
|
||||
mono_history,
|
||||
|
||||
Reference in New Issue
Block a user