Skip to content

Commit

Permalink
Appease Clippy and get automagic enum to string
Browse files Browse the repository at this point in the history
  • Loading branch information
rouge8 committed May 17, 2024
1 parent e21f8b6 commit 715186f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ sentry-tower = { version = "0.32.0", features = ["http", "axum-matched-path"] }
sentry-tracing = "0.32.0"
serde = { version = "1.0.188", features = ["derive"] }
serde_json = "1.0.107"
strum_macros = "0.26.2"
tokio = { version = "1.32.0", features = ["macros", "rt-multi-thread"] }
tower = "0.4.13"
tower-http = { version = "0.5.0", features = ["catch-panic", "trace", "fs", "compression-full"] }
Expand Down
13 changes: 2 additions & 11 deletions src/wanikani.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,15 @@ pub struct WaniKaniAPIClient<'a> {
client: &'a reqwest::Client,
}

#[derive(strum_macros::Display)]
#[strum(serialize_all = "snake_case")]
enum SubjectType {
Radical,
Kanji,
Vocabulary,
KanaVocabulary,
}

impl ToString for SubjectType {
fn to_string(&self) -> String {
match self {
SubjectType::Radical => "radical".to_string(),
SubjectType::Kanji => "kanji".to_string(),
SubjectType::Vocabulary => "vocabulary".to_string(),
SubjectType::KanaVocabulary => "kana_vocabulary".to_string(),
}
}
}

const APPRENTICE_SRS_STAGES: [u8; 4] = [1, 2, 3, 4];

impl<'a> WaniKaniAPIClient<'a> {
Expand Down

0 comments on commit 715186f

Please sign in to comment.