Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn fixes(ctx: &DiagnosticsContext<'_>, d: &RemoveUnnecessaryElse) -> Option<Vec<
let mut indent = IndentLevel::from_node(if_expr.syntax());
let has_parent_if_expr = if_expr.syntax().parent().and_then(ast::IfExpr::cast).is_some();
if has_parent_if_expr {
indent = indent + 1;
indent += 1;
}
let else_replacement = match if_expr.else_branch()? {
ast::ElseBranch::Block(block) => block
Expand Down
6 changes: 6 additions & 0 deletions crates/syntax/src/ast/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ impl ops::Add<u8> for IndentLevel {
}
}

impl ops::AddAssign<u8> for IndentLevel {
fn add_assign(&mut self, rhs: u8) {
self.0 += rhs;
}
}

impl IndentLevel {
pub fn single() -> IndentLevel {
IndentLevel(0)
Expand Down
Loading