Skip to content

Commit c075033

Browse files
committed
refactor: simplify explicit ref and deref
Cleans up the syntax a little. Was suggested in the PR review.
1 parent 9ca41ff commit c075033

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/range.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ pub(crate) fn rewrite_range(
4141
)
4242
};
4343

44-
match (lhs.as_ref().map(|x| &**x), rhs.as_ref().map(|x| &**x)) {
44+
match (lhs, rhs) {
4545
(Some(lhs), Some(rhs)) => {
4646
let sp_delim = if context.config.spaces_around_ranges() {
4747
format!(" {delim} ")
4848
} else {
4949
default_sp_delim(Some(lhs), Some(rhs))
5050
};
5151
rewrite_pair(
52-
&*lhs,
53-
&*rhs,
52+
lhs,
53+
rhs,
5454
PairParts::infix(&sp_delim),
5555
context,
5656
shape,
@@ -63,15 +63,15 @@ pub(crate) fn rewrite_range(
6363
} else {
6464
default_sp_delim(None, Some(rhs))
6565
};
66-
rewrite_unary_prefix(context, &sp_delim, &*rhs, shape)
66+
rewrite_unary_prefix(context, &sp_delim, rhs, shape)
6767
}
6868
(Some(lhs), None) => {
6969
let sp_delim = if context.config.spaces_around_ranges() {
7070
format!(" {delim}")
7171
} else {
7272
default_sp_delim(Some(lhs), None)
7373
};
74-
rewrite_unary_suffix(context, &sp_delim, &*lhs, shape)
74+
rewrite_unary_suffix(context, &sp_delim, lhs, shape)
7575
}
7676
(None, None) => Ok(delim.to_owned()),
7777
}

0 commit comments

Comments
 (0)