Skip to content

Commit 1361515

Browse files
committed
Replace generic with a concrete type
1 parent 1fe48a0 commit 1361515

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

crates/ra_assists/src/ast_transform.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//! `AstTransformer`s are functions that replace nodes in an AST and can be easily combined.
22
use rustc_hash::FxHashMap;
33

4-
use hir::{db::HirDatabase, InFile, PathResolution};
4+
use hir::{InFile, PathResolution};
5+
use ra_ide_db::RootDatabase;
56
use ra_syntax::ast::{self, AstNode};
67

78
pub trait AstTransform<'a> {
@@ -33,18 +34,18 @@ impl<'a> AstTransform<'a> for NullTransformer {
3334
}
3435
}
3536

36-
pub struct SubstituteTypeParams<'a, DB: HirDatabase> {
37-
db: &'a DB,
37+
pub struct SubstituteTypeParams<'a> {
38+
db: &'a RootDatabase,
3839
substs: FxHashMap<hir::TypeParam, ast::TypeRef>,
3940
previous: Box<dyn AstTransform<'a> + 'a>,
4041
}
4142

42-
impl<'a, DB: HirDatabase> SubstituteTypeParams<'a, DB> {
43+
impl<'a> SubstituteTypeParams<'a> {
4344
pub fn for_trait_impl(
44-
db: &'a DB,
45+
db: &'a RootDatabase,
4546
trait_: hir::Trait,
4647
impl_block: ast::ImplBlock,
47-
) -> SubstituteTypeParams<'a, DB> {
48+
) -> SubstituteTypeParams<'a> {
4849
let substs = get_syntactic_substs(impl_block).unwrap_or_default();
4950
let generic_def: hir::GenericDef = trait_.into();
5051
let substs_by_param: FxHashMap<_, _> = generic_def
@@ -95,7 +96,7 @@ impl<'a, DB: HirDatabase> SubstituteTypeParams<'a, DB> {
9596
}
9697
}
9798

98-
impl<'a, DB: HirDatabase> AstTransform<'a> for SubstituteTypeParams<'a, DB> {
99+
impl<'a> AstTransform<'a> for SubstituteTypeParams<'a> {
99100
fn get_substitution(
100101
&self,
101102
node: InFile<&ra_syntax::SyntaxNode>,
@@ -107,14 +108,14 @@ impl<'a, DB: HirDatabase> AstTransform<'a> for SubstituteTypeParams<'a, DB> {
107108
}
108109
}
109110

110-
pub struct QualifyPaths<'a, DB: HirDatabase> {
111-
db: &'a DB,
111+
pub struct QualifyPaths<'a> {
112+
db: &'a RootDatabase,
112113
from: Option<hir::Module>,
113114
previous: Box<dyn AstTransform<'a> + 'a>,
114115
}
115116

116-
impl<'a, DB: HirDatabase> QualifyPaths<'a, DB> {
117-
pub fn new(db: &'a DB, from: Option<hir::Module>) -> Self {
117+
impl<'a> QualifyPaths<'a> {
118+
pub fn new(db: &'a RootDatabase, from: Option<hir::Module>) -> Self {
118119
Self { db, from, previous: Box::new(NullTransformer) }
119120
}
120121

@@ -168,7 +169,7 @@ pub fn apply<'a, N: AstNode>(transformer: &dyn AstTransform<'a>, node: InFile<N>
168169
N::cast(result).unwrap()
169170
}
170171

171-
impl<'a, DB: HirDatabase> AstTransform<'a> for QualifyPaths<'a, DB> {
172+
impl<'a> AstTransform<'a> for QualifyPaths<'a> {
172173
fn get_substitution(
173174
&self,
174175
node: InFile<&ra_syntax::SyntaxNode>,

crates/rust-analyzer/src/semantic_tokens.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub(crate) fn supported_token_modifiers() -> &'static [SemanticTokenModifier] {
4949
}
5050

5151
/// Tokens are encoded relative to each other.
52-
///
52+
///
5353
/// This is a direct port of https://github.com/microsoft/vscode-languageserver-node/blob/f425af9de46a0187adb78ec8a46b9b2ce80c5412/server/src/sematicTokens.proposed.ts#L45
5454
#[derive(Default)]
5555
pub(crate) struct SemanticTokensBuilder {

0 commit comments

Comments
 (0)