Skip to content

Commit

Permalink
Remove trailing spaces by deleting the handler from end of the body
Browse files Browse the repository at this point in the history
  • Loading branch information
leiserfg committed Apr 9, 2023
1 parent a4daf7c commit 94f67cb
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ pub fn suppressible_exception(
stmt.location,
try_ending,
);
let remove_handler =
Edit::deletion(handler.location, handler.end_location.unwrap());
let remove_handler = Edit::deletion(
try_body.last().unwrap().end_location.unwrap(), // There must be at least one statement for it to be a valid try/except block
handler.end_location.unwrap(),
);
Ok(Fix::from_iter([import_edit, replace_try, remove_handler]))
});
}
Expand Down

0 comments on commit 94f67cb

Please sign in to comment.