on master help sign in
Collapse nested if statements (collapsible_if clippy)
commit5f8e1390574e37da0bda09e9a0df7249cdfeac6c authoriko <mail@iko.soy> dateSun 26 Apr 2026, 20:42 (5 months ago) parentaa14347
3 files changed+30−30
src/bin/htmlang_lsp/completion.rs+22−22 src/bin/htmlang_lsp/navigation.rs+4−4 src/main.rs+4−4
src/bin/htmlang_lsp/completion.rs+22−22
@@ -1371,28 +1371,28 @@ fn variable_completions(text: &str, range: Range) -> Vec<CompletionItem> {
13711371
13721372 for line in text.lines() {
13731373 let trimmed = line.trim();
1374− if let Some(rest) = trimmed.strip_prefix("@let ") {
1375− if let Some((name, value)) = rest.trim().split_once(' ') {
1376− let value = value.trim();
1377− if value.starts_with('[') {
1378− // Attribute bundle
1379− items.push(item(
1380− &format!("${}", name),
1381− CompletionItemKind::CONSTANT,
1382− "Attribute bundle",
1383− &format!("${}", name),
1384− range,
1385− ));
1386− } else if !value.starts_with('$') {
1387− // Scalar variable (skip function params like $param)
1388− items.push(item(
1389− &format!("${}", name),
1390− CompletionItemKind::VARIABLE,
1391− &format!("= {}", value),
1392− &format!("${}", name),
1393− range,
1394− ));
1395− }
1374+ if let Some(rest) = trimmed.strip_prefix("@let ")
1375+ && let Some((name, value)) = rest.trim().split_once(' ')
1376+ {
1377+ let value = value.trim();
1378+ if value.starts_with('[') {
1379+ // Attribute bundle
1380+ items.push(item(
1381+ &format!("${}", name),
1382+ CompletionItemKind::CONSTANT,
1383+ "Attribute bundle",
1384+ &format!("${}", name),
1385+ range,
1386+ ));
1387+ } else if !value.starts_with('$') {
1388+ // Scalar variable (skip function params like $param)
1389+ items.push(item(
1390+ &format!("${}", name),
1391+ CompletionItemKind::VARIABLE,
1392+ &format!("= {}", value),
1393+ &format!("${}", name),
1394+ range,
1395+ ));
13961396 }
13971397 }
13981398 }
src/bin/htmlang_lsp/navigation.rs+4−4
@@ -77,10 +77,10 @@ pub(crate) fn find_definition(text: &str, name: &str) -> Option<(u32, u32, u32)>
7777 for param in &parts[1..] {
7878 let p = param.strip_prefix('$').unwrap_or(param);
7979 let p = p.split('=').next().unwrap_or(p);
80− if p == name {
81− if let Some(pos) = line.find(param) {
82− return Some((i as u32, pos as u32, param.len() as u32));
83− }
80+ if p == name
81+ && let Some(pos) = line.find(param)
82+ {
83+ return Some((i as u32, pos as u32, param.len() as u32));
8484 }
8585 }
8686 } else if rest_trimmed == name {
src/main.rs+4−4
@@ -307,10 +307,10 @@ fn copy_non_hl_recursive(base: &Path, dir: &Path, out_dir: &Path, skip_canonical
307307 continue;
308308 }
309309 // Skip the output directory to avoid copying it into itself
310− if let Some(skip) = skip_canonical {
311− if path.canonicalize().ok().as_deref() == Some(skip) {
312− continue;
313− }
310+ if let Some(skip) = skip_canonical
311+ && path.canonicalize().ok().as_deref() == Some(skip)
312+ {
313+ continue;
314314 }
315315 copy_non_hl_recursive(base, &path, out_dir, skip_canonical);
316316 } else if path.is_file() && path.extension().is_none_or(|e| e != "hl") {