mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Merge #1547
1547: cleanup imports r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
abe72424a6
2 changed files with 5 additions and 6 deletions
|
@ -4,8 +4,7 @@ use hir::{Mutability, Ty};
|
||||||
use ra_db::SourceDatabase;
|
use ra_db::SourceDatabase;
|
||||||
use ra_prof::profile;
|
use ra_prof::profile;
|
||||||
use ra_syntax::{
|
use ra_syntax::{
|
||||||
ast, AstNode, Direction, Pat, PatKind, SmolStr, SyntaxElement, SyntaxKind, SyntaxKind::*,
|
ast, AstNode, Direction, SmolStr, SyntaxElement, SyntaxKind, SyntaxKind::*, TextRange, T,
|
||||||
TextRange, T,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{db::RootDatabase, FileId};
|
use crate::{db::RootDatabase, FileId};
|
||||||
|
@ -32,7 +31,7 @@ fn is_control_keyword(kind: SyntaxKind) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_variable_mutable(db: &RootDatabase, analyzer: &hir::SourceAnalyzer, pat: &Pat) -> bool {
|
fn is_variable_mutable(db: &RootDatabase, analyzer: &hir::SourceAnalyzer, pat: &ast::Pat) -> bool {
|
||||||
let ty = analyzer.type_of_pat(db, pat).unwrap_or(Ty::Unknown);
|
let ty = analyzer.type_of_pat(db, pat).unwrap_or(Ty::Unknown);
|
||||||
let is_ty_mut = {
|
let is_ty_mut = {
|
||||||
if let Some((_, mutability)) = ty.as_reference() {
|
if let Some((_, mutability)) = ty.as_reference() {
|
||||||
|
@ -46,7 +45,7 @@ fn is_variable_mutable(db: &RootDatabase, analyzer: &hir::SourceAnalyzer, pat: &
|
||||||
};
|
};
|
||||||
|
|
||||||
let is_pat_mut = match pat.kind() {
|
let is_pat_mut = match pat.kind() {
|
||||||
PatKind::BindPat(bind_pat) => bind_pat.is_mutable(),
|
ast::PatKind::BindPat(bind_pat) => bind_pat.is_mutable(),
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -137,7 +136,7 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
|
||||||
NAME => {
|
NAME => {
|
||||||
if let Some(name) = node.as_node().and_then(ast::Name::cast) {
|
if let Some(name) = node.as_node().and_then(ast::Name::cast) {
|
||||||
let analyzer = hir::SourceAnalyzer::new(db, file_id, name.syntax(), None);
|
let analyzer = hir::SourceAnalyzer::new(db, file_id, name.syntax(), None);
|
||||||
if let Some(pat) = name.syntax().ancestors().find_map(Pat::cast) {
|
if let Some(pat) = name.syntax().ancestors().find_map(ast::Pat::cast) {
|
||||||
binding_hash = Some({
|
binding_hash = Some({
|
||||||
let text = name.syntax().text().to_smol_string();
|
let text = name.syntax().text().to_smol_string();
|
||||||
let shadow_count =
|
let shadow_count =
|
||||||
|
|
|
@ -38,7 +38,7 @@ use ra_text_edit::AtomTextEdit;
|
||||||
use crate::syntax_node::GreenNode;
|
use crate::syntax_node::GreenNode;
|
||||||
|
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
ast::{AstNode, Pat, PatKind},
|
ast::{AstNode, AstToken},
|
||||||
parsing::{classify_literal, tokenize, Token},
|
parsing::{classify_literal, tokenize, Token},
|
||||||
ptr::{AstPtr, SyntaxNodePtr},
|
ptr::{AstPtr, SyntaxNodePtr},
|
||||||
syntax_error::{Location, SyntaxError, SyntaxErrorKind},
|
syntax_error::{Location, SyntaxError, SyntaxErrorKind},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue