on master help sign in
Fix clippy warnings: collapse nested match and if statements
commit7a8d758a97e90ab45cd05811efa93c4bb9b41f53 authoriko <mail@iko.soy> dateSun 26 Apr 2026, 18:39 (5 months ago) parentcc6e75c
2 files changed+14−24
crates/htmlang-core/src/codegen.rs+1−5 crates/htmlang-core/src/parser.rs+13−19
crates/htmlang-core/src/codegen.rs+1−5
@@ -3886,11 +3886,7 @@ fn auto_extract_repeats(
38863886 while end < bytes.len() {
38873887 match bytes[end] {
38883888 b'(' => pdepth += 1,
3889− b')' => {
3890− if pdepth > 0 {
3891− pdepth -= 1;
3892− }
3893− }
3889+ b')' if pdepth > 0 => pdepth -= 1,
38943890 b';' | b'}' if pdepth == 0 => break,
38953891 b'{' if pdepth == 0 => break,
38963892 _ => {}
crates/htmlang-core/src/parser.rs+13−19
@@ -4414,21 +4414,21 @@ fn parse_attr_list(
44144414 }
44154415
44164416 // ...$name spread — expand define/attribute bundle
4417− if let Some(name) = part.strip_prefix("...$") {
4418− if let Some(define_attrs) = ctx.defines.get(name) {
4419− ctx.used_defines.insert(name.to_string());
4420− attrs.extend(define_attrs.clone());
4421− continue;
4422− }
4417+ if let Some(name) = part.strip_prefix("...$")
4418+ && let Some(define_attrs) = ctx.defines.get(name)
4419+ {
4420+ ctx.used_defines.insert(name.to_string());
4421+ attrs.extend(define_attrs.clone());
4422+ continue;
44234423 }
44244424
44254425 // $define reference — expand attribute bundle
4426− if let Some(name) = part.strip_prefix('$') {
4427− if let Some(define_attrs) = ctx.defines.get(name) {
4428− ctx.used_defines.insert(name.to_string());
4429− attrs.extend(define_attrs.clone());
4430− continue;
4431− }
4426+ if let Some(name) = part.strip_prefix('$')
4427+ && let Some(define_attrs) = ctx.defines.get(name)
4428+ {
4429+ ctx.used_defines.insert(name.to_string());
4430+ attrs.extend(define_attrs.clone());
4431+ continue;
44324432 }
44334433
44344434 // Substitute variables in value
@@ -4837,13 +4837,7 @@ fn evaluate_arithmetic(input: &str) -> String {
48374837 '+' => l + r,
48384838 '-' => l - r,
48394839 '*' => l * r,
4840− '/' => {
4841− if r != 0.0 {
4842− l / r
4843− } else {
4844− return input.to_string();
4845− }
4846− }
4840+ '/' if r != 0.0 => l / r,
48474841 _ => return input.to_string(),
48484842 };
48494843 if result == result.floor() && result.abs() < i64::MAX as f64 {