mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
fix formatting
and remove unnecessary check
This commit is contained in:
parent
a778203db9
commit
8b17681058
2 changed files with 7 additions and 5 deletions
|
@ -268,8 +268,7 @@ fn hover_type_fallback(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let res =
|
let res = render::type_info(sema, config, &expr_or_pat)
|
||||||
render::type_info(sema, config, &expr_or_pat)
|
|
||||||
.or_else(|| render::struct_rest_pat(sema, config, &expr_or_pat))?;
|
.or_else(|| render::struct_rest_pat(sema, config, &expr_or_pat))?;
|
||||||
|
|
||||||
let range = sema
|
let range = sema
|
||||||
|
|
|
@ -14,7 +14,9 @@ use ide_db::{
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use stdx::format_to;
|
use stdx::format_to;
|
||||||
use syntax::{
|
use syntax::{
|
||||||
algo, ast::{self, RecordPat}, match_ast, AstNode, Direction,
|
algo,
|
||||||
|
ast::{self, RecordPat},
|
||||||
|
match_ast, AstNode, Direction,
|
||||||
SyntaxKind::{LET_EXPR, LET_STMT},
|
SyntaxKind::{LET_EXPR, LET_STMT},
|
||||||
SyntaxToken, T,
|
SyntaxToken, T,
|
||||||
};
|
};
|
||||||
|
@ -263,7 +265,8 @@ pub(super) fn struct_rest_pat(
|
||||||
let pattern = sema
|
let pattern = sema
|
||||||
.find_nodes_at_offset_with_descend::<RecordPat>(
|
.find_nodes_at_offset_with_descend::<RecordPat>(
|
||||||
&record_pat,
|
&record_pat,
|
||||||
record_pat.text_range().start())
|
record_pat.text_range().start(),
|
||||||
|
)
|
||||||
.next()?;
|
.next()?;
|
||||||
|
|
||||||
let missing_fields = sema.record_pattern_missing_fields(&pattern);
|
let missing_fields = sema.record_pattern_missing_fields(&pattern);
|
||||||
|
@ -290,7 +293,7 @@ pub(super) fn struct_rest_pat(
|
||||||
s += ", ";
|
s += ", ";
|
||||||
}
|
}
|
||||||
// get rid of trailing comma
|
// get rid of trailing comma
|
||||||
if s.len() > 0 {s.truncate(s.len() - 2);}
|
s.truncate(s.len() - 2);
|
||||||
|
|
||||||
if config.markdown() {
|
if config.markdown() {
|
||||||
Markup::fenced_block(&s)
|
Markup::fenced_block(&s)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue