Skip to content

Commit faa74f2

Browse files
unhappychoiceclaude
andcommitted
refactor: implement Default trait for new() methods
Add Default trait implementations for SourceFileExtractor and FileStorage to follow Rust conventions and suppress clippy warnings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6675171 commit faa74f2

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/domain/services/source_file_extractor/source_file_extractor.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ pub struct SourceFileExtractor {
99
file_storage: FileStorage,
1010
}
1111

12+
impl Default for SourceFileExtractor {
13+
fn default() -> Self {
14+
Self::new()
15+
}
16+
}
17+
1218
impl SourceFileExtractor {
1319
pub fn new() -> Self {
1420
Self {
@@ -93,7 +99,7 @@ impl SourceFileExtractor {
9399
Ok(files)
94100
}
95101

96-
fn is_supported_language(&self, path: &PathBuf) -> bool {
102+
fn is_supported_language(&self, path: &Path) -> bool {
97103
path.extension()
98104
.and_then(|e| e.to_str())
99105
.map(|extension| Languages::from_extension(extension).is_some())

src/infrastructure/storage/file_storage.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ mod mock_impl {
121121

122122
impl AppDataProvider for FileStorage {}
123123

124+
impl Default for FileStorage {
125+
fn default() -> Self {
126+
Self::new()
127+
}
128+
}
129+
124130
impl FileStorage {
125131
pub fn new() -> Self {
126132
Self { files: Vec::new() }

0 commit comments

Comments
 (0)