Skip to content

Commit ead9486

Browse files
committed
Fix clippy warnings in diagnostics module
- Add #[must_use] to get_severity and is_enabled methods - Replace map().unwrap_or() with more idiomatic map_or()
1 parent 3df8952 commit ead9486

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/djls-conf/src/diagnostics.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ impl DiagnosticsConfig {
4848
/// 1. Exact match (e.g., "S100")
4949
/// 2. Longest prefix match (e.g., "S1" over "S")
5050
/// 3. Default: Error
51+
#[must_use]
5152
pub fn get_severity(&self, code: &str) -> DiagnosticSeverity {
5253
// First, check for exact match
5354
if let Some(&severity) = self.severity.get(code) {
@@ -72,11 +73,11 @@ impl DiagnosticsConfig {
7273
}
7374

7475
best_match
75-
.map(|(_, severity)| severity)
76-
.unwrap_or(DiagnosticSeverity::Error)
76+
.map_or(DiagnosticSeverity::Error, |(_, severity)| severity)
7777
}
7878

7979
/// Check if a diagnostic should be shown (severity is not Off).
80+
#[must_use]
8081
pub fn is_enabled(&self, code: &str) -> bool {
8182
self.get_severity(code) != DiagnosticSeverity::Off
8283
}

0 commit comments

Comments
 (0)