chore: mark clippy fixes as completed in PLAN.md
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
69
PLAN.md
69
PLAN.md
@@ -8,304 +8,373 @@ This document outlines the current state of the codebase and planned changes, pa
|
||||
- **Issue**: Empty line after doc comment at line 32.
|
||||
- **Description**: The doc comment for the `impl CompressionService` block ends with a code example, followed by an empty line. Clippy flags this as unnecessary.
|
||||
- **Fix**: Remove the empty line after the doc comment example.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/filter_plugin/mod.rs
|
||||
- **Issue**: Empty line after doc comment at line 194.
|
||||
- **Description**: Similar to above, the doc comment for `impl Clone for FilterChain` has an empty line.
|
||||
- **Fix**: Remove the empty line.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/common/is_binary.rs
|
||||
- **Issue**: Collapsible if statements at lines 15-17.
|
||||
- **Description**: Nested if for UTF-16 BOM check can be flattened.
|
||||
- **Fix**: Combine into a single condition.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Let binding returned immediately at line 218.
|
||||
- **Description**: The `has_reasonable_structure` let binding is returned directly; unnecessary.
|
||||
- **Fix**: Return the expression directly without the binding.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Needless range loop at line 192.
|
||||
- **Description**: Loop variable `i` only used for indexing; use iterator instead.
|
||||
- **Fix**: Replace with `data[100..108].iter()`.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Needless range loop at line 199.
|
||||
- **Description**: Similar to above for checksum field.
|
||||
- **Fix**: Replace with `data[148..156].iter()`.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Manual range contains at line 216.
|
||||
- **Description**: `(b >= b'0' && b <= b'7')` can use `RangeInclusive::contains`.
|
||||
- **Fix**: Change to `(b'0'..=b'7').contains(&b)`.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/common/status.rs
|
||||
- **Issue**: Borrowed box instead of slice at line 59.
|
||||
- **Description**: `&Vec<MetaPluginType>` can be `&[MetaPluginType]`.
|
||||
- **Fix**: Update the parameter type.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Unnecessary map_or at line 91.
|
||||
- **Description**: `as_ref().map_or(false, |ct| *ct == compression_type)` can be simplified.
|
||||
- **Fix**: Use `is_some_and(|ct| *ct == compression_type)`.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/config.rs
|
||||
- **Issue**: Match result_ok at line 198.
|
||||
- **Description**: `std::env::var("HOME").ok()` is redundant.
|
||||
- **Fix**: Change to `if let Ok(home_dir) = std::env::var("HOME")`.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/services/async_item_service.rs
|
||||
- **Issue**: Redundant local binding at line 214.
|
||||
- **Description**: `let item_id = item_id;` is unnecessary.
|
||||
- **Fix**: Remove the redundant let.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/services/compression_service.rs
|
||||
- **Issue**: Four forward slashes in comment at line 8.
|
||||
- **Description**: `////` looks like a doc comment but isn't.
|
||||
- **Fix**: Change to `///` and ensure it's a proper doc comment.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/services/filter_service.rs
|
||||
- **Issue**: New without default at line 35.
|
||||
- **Description**: `FilterService` has `new()` but no `Default` impl.
|
||||
- **Fix**: Add `impl Default for FilterService { fn default() -> Self { Self::new() } }`.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Type complexity at line 161.
|
||||
- **Description**: The static `FILTER_PLUGIN_REGISTRY` type is too complex.
|
||||
- **Fix**: Factor into a type alias.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/services/meta_service.rs
|
||||
- **Issue**: Unwrap or default at line 84.
|
||||
- **Description**: `or_insert_with(Vec::new)` can be `or_default()`.
|
||||
- **Fix**: Replace with `or_default()`.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Borrowed box at line 164.
|
||||
- **Description**: `&Box<dyn MetaPlugin>` can be `&dyn MetaPlugin`.
|
||||
- **Fix**: Update to `&dyn MetaPlugin`.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 199.
|
||||
- **Description**: Nested if for hostname insertion.
|
||||
- **Fix**: Combine conditions.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/db.rs
|
||||
- **Issue**: Unwrap or default at line 1209.
|
||||
- **Description**: `or_insert_with(Vec::new)` for tags.
|
||||
- **Fix**: Use `or_default()`.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Unwrap or default at line 1264.
|
||||
- **Description**: `or_insert_with(std::collections::HashMap::new)` for meta.
|
||||
- **Fix**: Use `or_default()`.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/meta_plugin/magic_file.rs
|
||||
- **Issue**: Io other error at line 70.
|
||||
- **Description**: Manual `io::Error::new(io::ErrorKind::Other, ...)` can be `io::Error::other`.
|
||||
- **Fix**: Replace with `io::Error::other(format!(...))`.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Io other error at line 73.
|
||||
- **Description**: Similar to above.
|
||||
- **Fix**: Replace with `io::Error::other(format!(...))`.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Io other error at line 89.
|
||||
- **Description**: Manual error creation.
|
||||
- **Fix**: Replace with `io::Error::other(...)`.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 105.
|
||||
- **Description**: Nested if for magic result processing.
|
||||
- **Fix**: Combine into single condition.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/meta_plugin/exec.rs
|
||||
- **Issue**: Collapsible if at line 281.
|
||||
- **Description**: Nested if for writing to stdin.
|
||||
- **Fix**: Combine conditions.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at lines 380-383.
|
||||
- **Description**: Nested if for command parsing.
|
||||
- **Fix**: Collapse nested lets and ifs.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 390.
|
||||
- **Description**: Nested if for split_whitespace.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 395.
|
||||
- **Description**: Nested if for name.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/meta_plugin/digest.rs
|
||||
- **Issue**: Derivable impls at line 69.
|
||||
- **Description**: `Default` impl can be derived.
|
||||
- **Fix**: Add `#[derive(Default)]` to `DigestMetaPlugin`.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 137.
|
||||
- **Description**: Nested if for updating outputs.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/meta_plugin/text.rs
|
||||
- **Issue**: Collapsible if at line 388.
|
||||
- **Description**: Nested if for median length.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 389.
|
||||
- **Description**: Nested if for lengths check.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 608.
|
||||
- **Description**: Nested if for binary content check.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 609.
|
||||
- **Description**: Nested if for buffer check.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 649.
|
||||
- **Description**: Nested if for enabled outputs.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/meta_plugin/hostname.rs
|
||||
- **Issue**: Collapsible if at line 37.
|
||||
- **Description**: Nested if for hostname option handling.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 155.
|
||||
- **Description**: Nested if for domainname command.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 168.
|
||||
- **Description**: Nested if for hostname -f command.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 268.
|
||||
- **Description**: Nested if for hostname_enabled.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 277.
|
||||
- **Description**: Nested if for hostname_full_enabled.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 286.
|
||||
- **Description**: Nested if for hostname_short_enabled.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/meta_plugin/mod.rs
|
||||
- **Issue**: Redundant closure at line 208.
|
||||
- **Description**: `Lazy::new(|| HashMap::new())` unnecessary closure.
|
||||
- **Fix**: Use `HashMap::new()` directly.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 228.
|
||||
- **Description**: Nested if for output disabling.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Redundant closure at line 374.
|
||||
- **Description**: Similar to above.
|
||||
- **Fix**: Use directly.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Redundant closure at line 395.
|
||||
- **Description**: Similar.
|
||||
- **Fix**: Use directly.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Type complexity at line 431.
|
||||
- **Description**: Complex static type.
|
||||
- **Fix**: Factor into type alias.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Type complexity at line 442.
|
||||
- **Description**: Complex fn type in registry.
|
||||
- **Fix**: Factor into type alias.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 466.
|
||||
- **Description**: Nested if for command parsing.
|
||||
- **Fix**: Collapse.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 476.
|
||||
- **Description**: Nested if for split_whitespace.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 481.
|
||||
- **Description**: Nested if for name.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/modes/common.rs
|
||||
- **Issue**: Should implement trait at line 175.
|
||||
- **Description**: `from_str` method shadows trait; implement FromStr.
|
||||
- **Fix**: Add `impl FromStr for ColumnType` with the method.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/modes/delete.rs
|
||||
- **Issue**: Ptr arg at line 51.
|
||||
- **Description**: `&mut Vec<i64>` can be `&mut [i64]`.
|
||||
- **Fix**: Update parameter.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Ptr arg at line 52.
|
||||
- **Description**: `&mut Vec<String>` can be `&mut [String]`.
|
||||
- **Fix**: Update parameter.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/modes/diff.rs
|
||||
- **Issue**: Ptr arg at line 11.
|
||||
- **Description**: `&Vec<i64>` can be `&[i64]`.
|
||||
- **Fix**: Update.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Ptr arg at line 11.
|
||||
- **Description**: `&Vec<String>` can be `&[String]`.
|
||||
- **Fix**: Update.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Ptr arg at line 37.
|
||||
- **Description**: `&Vec<i64>` can be `&[i64]`.
|
||||
- **Fix**: Update.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/modes/get.rs
|
||||
- **Issue**: Ptr arg at line 32.
|
||||
- **Description**: `&mut Vec<i64>` can be `&mut [i64]`.
|
||||
- **Fix**: Update.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Ptr arg at line 33.
|
||||
- **Description**: `&mut Vec<String>` can be `&mut [String]`.
|
||||
- **Fix**: Update.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/modes/info.rs
|
||||
- **Issue**: Ptr arg at line 45.
|
||||
- **Description**: `&mut Vec<i64>` can be `&mut [i64]`.
|
||||
- **Fix**: Update.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Ptr arg at line 46.
|
||||
- **Description**: `&mut Vec<String>` can be `&mut [String]`.
|
||||
- **Fix**: Update.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Needless borrows for generic args at line 142.
|
||||
- **Description**: `&item_id.to_string()` unnecessary borrow.
|
||||
- **Fix**: Use `item_id.to_string()` directly.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/modes/list.rs
|
||||
- **Issue**: Ptr arg at line 164.
|
||||
- **Description**: `&mut Vec<i64>` can be `&mut [i64]`.
|
||||
- **Fix**: Update.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Ptr arg at line 165.
|
||||
- **Description**: `&Vec<String>` can be `&[String]`.
|
||||
- **Fix**: Update.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/modes/save.rs
|
||||
- **Issue**: Ptr arg at line 21.
|
||||
- **Description**: `&Vec<i64>` can be `&[i64]`.
|
||||
- **Fix**: Update.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/modes/status_plugins.rs
|
||||
- **Issue**: Ptr arg at line 175.
|
||||
- **Description**: `&Vec<FilterPluginInfo>` can be `&[FilterPluginInfo]`.
|
||||
- **Fix**: Update.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/filter_plugin/strip_ansi.rs
|
||||
- **Issue**: New without default at line 14.
|
||||
- **Description**: `StripAnsiFilter` has `new()` but no `Default` impl.
|
||||
- **Fix**: Add `impl Default for StripAnsiFilter { fn default() -> Self { Self::new() } }`.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/filter_plugin/mod.rs
|
||||
- **Issue**: New without default at line 235.
|
||||
- **Description**: `FilterChain` has `new()` but no `Default` impl.
|
||||
- **Fix**: Add `impl Default for FilterChain { fn default() -> Self { Self::new() } }`.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
- **Issue**: Collapsible if at line 586.
|
||||
- **Description**: Nested if for f64 parsing.
|
||||
- **Fix**: Combine.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
### src/meta_plugin/mod.rs
|
||||
- **Issue**: Borrowed box at line 164? Wait, no specific line, but earlier note.
|
||||
- **Description**: Ensure no unnecessary borrows.
|
||||
- **Status**: COMPLETED
|
||||
|
||||
## General Changes
|
||||
- Ensure all `Default` impls are derived where possible (e.g., add derives).
|
||||
- Remove redundant locals and unnecessary let bindings.
|
||||
- Update all parameter types from `&Vec<T>` to `&[T]` and `&mut Vec<T>` to `&mut [T]` where appropriate (function signatures).
|
||||
- **Status**: COMPLETED
|
||||
|
||||
## Next Steps
|
||||
1. Apply the fixes above.
|
||||
|
||||
Reference in New Issue
Block a user