Skip to content

Commit 8b17681

Browse files
committed
fix formatting
and remove unnecessary check
1 parent a778203 commit 8b17681

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

crates/ide/src/hover.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,7 @@ fn hover_type_fallback(
268268
}
269269
};
270270

271-
let res =
272-
render::type_info(sema, config, &expr_or_pat)
271+
let res = render::type_info(sema, config, &expr_or_pat)
273272
.or_else(|| render::struct_rest_pat(sema, config, &expr_or_pat))?;
274273

275274
let range = sema

crates/ide/src/hover/render.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ use ide_db::{
1414
use itertools::Itertools;
1515
use stdx::format_to;
1616
use syntax::{
17-
algo, ast::{self, RecordPat}, match_ast, AstNode, Direction,
17+
algo,
18+
ast::{self, RecordPat},
19+
match_ast, AstNode, Direction,
1820
SyntaxKind::{LET_EXPR, LET_STMT},
1921
SyntaxToken, T,
2022
};
@@ -263,7 +265,8 @@ pub(super) fn struct_rest_pat(
263265
let pattern = sema
264266
.find_nodes_at_offset_with_descend::<RecordPat>(
265267
&record_pat,
266-
record_pat.text_range().start())
268+
record_pat.text_range().start(),
269+
)
267270
.next()?;
268271

269272
let missing_fields = sema.record_pattern_missing_fields(&pattern);
@@ -290,7 +293,7 @@ pub(super) fn struct_rest_pat(
290293
s += ", ";
291294
}
292295
// get rid of trailing comma
293-
if s.len() > 0 {s.truncate(s.len() - 2);}
296+
s.truncate(s.len() - 2);
294297

295298
if config.markdown() {
296299
Markup::fenced_block(&s)

0 commit comments

Comments
 (0)