generated from nhcarrigan/template
chore: clippy
This commit is contained in:
@@ -114,10 +114,12 @@ impl AchievementProgress {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
pub fn take_newly_unlocked(&mut self) -> Vec<AchievementId> {
|
pub fn take_newly_unlocked(&mut self) -> Vec<AchievementId> {
|
||||||
std::mem::take(&mut self.newly_unlocked)
|
std::mem::take(&mut self.newly_unlocked)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
pub fn is_unlocked(&self, achievement: &AchievementId) -> bool {
|
pub fn is_unlocked(&self, achievement: &AchievementId) -> bool {
|
||||||
self.unlocked.contains(achievement)
|
self.unlocked.contains(achievement)
|
||||||
}
|
}
|
||||||
@@ -647,7 +649,7 @@ pub fn check_achievements(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Special first-time achievements
|
// Special first-time achievements
|
||||||
if stats.tools_usage.len() >= 1 && progress.unlock(AchievementId::FirstTool) {
|
if !stats.tools_usage.is_empty() && progress.unlock(AchievementId::FirstTool) {
|
||||||
newly_unlocked.push(AchievementId::FirstTool);
|
newly_unlocked.push(AchievementId::FirstTool);
|
||||||
}
|
}
|
||||||
if stats.code_blocks_generated >= 1 && progress.unlock(AchievementId::FirstCodeBlock) {
|
if stats.code_blocks_generated >= 1 && progress.unlock(AchievementId::FirstCodeBlock) {
|
||||||
@@ -697,7 +699,7 @@ pub fn check_achievements(
|
|||||||
let weekday = session_start.weekday();
|
let weekday = session_start.weekday();
|
||||||
|
|
||||||
// Early bird - 5 AM to 7 AM
|
// Early bird - 5 AM to 7 AM
|
||||||
if hour >= 5 && hour <= 7 && progress.unlock(AchievementId::EarlyBird) {
|
if (5..=7).contains(&hour) && progress.unlock(AchievementId::EarlyBird) {
|
||||||
newly_unlocked.push(AchievementId::EarlyBird);
|
newly_unlocked.push(AchievementId::EarlyBird);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -708,7 +710,7 @@ pub fn check_achievements(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// All nighter - 2 AM to 5 AM
|
// All nighter - 2 AM to 5 AM
|
||||||
if current_hour >= 2 && current_hour <= 5 && progress.unlock(AchievementId::AllNighter) {
|
if (2..=5).contains(¤t_hour) && progress.unlock(AchievementId::AllNighter) {
|
||||||
newly_unlocked.push(AchievementId::AllNighter);
|
newly_unlocked.push(AchievementId::AllNighter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ impl WslBridge {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub async fn new_with_loaded_achievements(app: &tauri::AppHandle) -> Self {
|
pub async fn new_with_loaded_achievements(app: &tauri::AppHandle) -> Self {
|
||||||
let bridge = Self::new();
|
let bridge = Self::new();
|
||||||
|
|
||||||
@@ -354,10 +355,12 @@ impl WslBridge {
|
|||||||
self.stats.read().clone()
|
self.stats.read().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn update_stats(&mut self, input_tokens: u64, output_tokens: u64, model: &str) {
|
pub fn update_stats(&mut self, input_tokens: u64, output_tokens: u64, model: &str) {
|
||||||
self.stats.write().add_usage(input_tokens, output_tokens, model);
|
self.stats.write().add_usage(input_tokens, output_tokens, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn reset_session_stats(&mut self) {
|
pub fn reset_session_stats(&mut self) {
|
||||||
self.stats.write().reset_session();
|
self.stats.write().reset_session();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user