Skip to content

Commit

Permalink
change matches to match statement
Browse files Browse the repository at this point in the history
  • Loading branch information
gabydd committed Dec 4, 2022
1 parent f5d744c commit 5396755
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions helix-core/src/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,17 @@ fn find_block_comments(
);

// margin of one if there is a space between the comment token and other characters
let open_margin = if matches!(selection_slice.get_char(open_pos + open.len()), Some(c) if c == ' ')
{
1
} else {
0
};
let close_margin = if matches!(selection_slice.get_char(close_pos - std::cmp::min(close.len(), close_pos)), Some(c) if c == ' ')
{
1
} else {
0
let open_margin = match selection_slice.get_char(open_pos + open.len()) {
Some(c) if c == ' ' => 1,
_ => 0,
};

let close_margin =
match selection_slice.get_char(close_pos - std::cmp::min(close.len(), close_pos)) {
Some(c) if c == ' ' => 1,
_ => 0,
};

if !(open_fragment == open && close_fragment == close) {
// as soon as one of the selections doesn't have a comment, only uncommented selections
// should be changed.
Expand Down

0 comments on commit 5396755

Please sign in to comment.