Skip to content

Commit 3ee362f

Browse files
committed
fix: resolve clippy warnings for CI compliance
- Replace deprecated gix work_dir() with workdir() - Rename CommitType::from_str to parse to avoid clippy should_implement_trait warning - Add #[allow(dead_code)] for enum variants and parse() used only via ALL const and in tests
1 parent 1ae1bdd commit 3ee362f

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

src/domain/commit.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// SPDX-License-Identifier: GPL-3.0-only
44

55
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
6+
#[allow(dead_code)]
67
pub enum CommitType {
78
Feat,
89
Fix,
@@ -40,7 +41,8 @@ impl CommitType {
4041
}
4142
}
4243

43-
pub fn from_str(s: &str) -> Option<Self> {
44+
#[allow(dead_code)]
45+
pub fn parse(s: &str) -> Option<Self> {
4446
match s {
4547
"feat" => Some(Self::Feat),
4648
"fix" => Some(Self::Fix),

src/services/git.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl GitService {
1717
let repo = gix::discover(".").map_err(|_| Error::NotAGitRepo)?;
1818

1919
let work_dir = repo
20-
.work_dir()
20+
.workdir()
2121
.ok_or_else(|| Error::Git("Bare repository not supported".into()))?
2222
.to_path_buf();
2323

tests/commit_type.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ fn all_matches_enum_variants() {
99
assert_eq!(CommitType::ALL.len(), 11);
1010
for s in CommitType::ALL {
1111
assert!(
12-
CommitType::from_str(s).is_some(),
13-
"ALL entry {:?} has no matching from_str result",
12+
CommitType::parse(s).is_some(),
13+
"ALL entry {:?} has no matching parse result",
1414
s
1515
);
1616
}
1717
}
1818

1919
#[test]
20-
fn from_str_roundtrips() {
20+
fn parse_roundtrips() {
2121
for s in CommitType::ALL {
22-
let ct = CommitType::from_str(s).unwrap();
22+
let ct = CommitType::parse(s).unwrap();
2323
assert_eq!(
2424
ct.as_str(),
2525
*s,
@@ -31,10 +31,10 @@ fn from_str_roundtrips() {
3131
}
3232

3333
#[test]
34-
fn from_str_rejects_invalid() {
34+
fn parse_rejects_invalid() {
3535
for invalid in &["yolo", "", "FEAT"] {
3636
assert!(
37-
CommitType::from_str(invalid).is_none(),
37+
CommitType::parse(invalid).is_none(),
3838
"expected None for {:?}, but got Some",
3939
invalid
4040
);
@@ -46,7 +46,7 @@ fn display_matches_as_str() {
4646
assert_eq!(format!("{}", CommitType::Feat), "feat");
4747

4848
for s in CommitType::ALL {
49-
let ct = CommitType::from_str(s).unwrap();
49+
let ct = CommitType::parse(s).unwrap();
5050
assert_eq!(
5151
ct.to_string(),
5252
ct.as_str(),

0 commit comments

Comments
 (0)