mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-23 11:54:25 +00:00
Merge #9474
9474: fix: Inline parameters in `inline_call` if possible r=Veykril a=Veykril Fixes #9491 Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
2bc4f9e371
5 changed files with 267 additions and 78 deletions
|
@ -431,6 +431,12 @@ impl ast::RecordExprFieldList {
|
|||
}
|
||||
}
|
||||
|
||||
impl ast::BlockExpr {
|
||||
pub fn push_front(&self, statement: ast::Stmt) {
|
||||
ted::insert(Position::after(self.l_curly_token().unwrap()), statement.syntax());
|
||||
}
|
||||
}
|
||||
|
||||
fn normalize_ws_between_braces(node: &SyntaxNode) -> Option<()> {
|
||||
let l = node
|
||||
.children_with_tokens()
|
||||
|
|
|
@ -641,6 +641,15 @@ impl ast::SlicePat {
|
|||
}
|
||||
}
|
||||
|
||||
impl ast::IdentPat {
|
||||
pub fn is_simple_ident(&self) -> bool {
|
||||
self.at_token().is_none()
|
||||
&& self.mut_token().is_none()
|
||||
&& self.ref_token().is_none()
|
||||
&& self.pat().is_none()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum SelfParamKind {
|
||||
/// self
|
||||
|
|
|
@ -187,6 +187,12 @@ fn ws_between(left: &SyntaxElement, right: &SyntaxElement) -> Option<SyntaxToken
|
|||
return None;
|
||||
}
|
||||
|
||||
if left.kind() == T!['{'] && right.kind() == SyntaxKind::LET_STMT {
|
||||
let mut indent = IndentLevel::from_element(left);
|
||||
indent.0 += 1;
|
||||
return Some(make::tokens::whitespace(&format!("\n{}", indent)));
|
||||
}
|
||||
|
||||
if right.kind() == SyntaxKind::USE {
|
||||
let mut indent = IndentLevel::from_element(left);
|
||||
if left.kind() == SyntaxKind::USE {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue