Skip to content

Commit 51c3bd2

Browse files
committed
Fix suggestions of unstable constants
1 parent 3825d8b commit 51c3bd2

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

crates/hir/src/term_search/tactics.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use itertools::Itertools;
1717
use rustc_hash::FxHashSet;
1818

1919
use crate::{
20-
Adt, AssocItem, GenericDef, GenericParam, HasVisibility, Impl, ModuleDef, ScopeDef, Type,
21-
TypeParam,
20+
Adt, AssocItem, GenericDef, GenericParam, HasAttrs, HasVisibility, Impl, ModuleDef, ScopeDef,
21+
Type, TypeParam,
2222
};
2323

2424
use crate::term_search::Expr;
@@ -122,6 +122,10 @@ pub(super) fn assoc_const<'a, DB: HirDatabase>(
122122
.filter(move |it| it.is_visible_from(db, module))
123123
.filter_map(AssocItem::as_const)
124124
.filter_map(|it| {
125+
if it.attrs(db).is_unstable() {
126+
return None;
127+
}
128+
125129
let expr = Expr::Const(it);
126130
let ty = it.ty(db);
127131

@@ -472,7 +476,7 @@ pub(super) fn impl_method<'a, DB: HirDatabase>(
472476

473477
// Ignore functions with generics for now as they kill the performance
474478
// Also checking bounds for generics is problematic
475-
if fn_generics.type_or_const_params(db).len() > 0 {
479+
if !fn_generics.type_or_const_params(db).is_empty() {
476480
return None;
477481
}
478482

@@ -661,7 +665,7 @@ pub(super) fn impl_static_method<'a, DB: HirDatabase>(
661665

662666
// Ignore functions with generics for now as they kill the performance
663667
// Also checking bounds for generics is problematic
664-
if fn_generics.type_or_const_params(db).len() > 0 {
668+
if !fn_generics.type_or_const_params(db).is_empty() {
665669
return None;
666670
}
667671

docs/user/generated_config.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ for enum variants.
99
--
1010
Placeholder expression to use for missing expressions in assists.
1111
--
12-
[[rust-analyzer.assist.termSearch.fuel]]rust-analyzer.assist.termSearch.fuel (default: `400`)::
12+
[[rust-analyzer.assist.termSearch.fuel]]rust-analyzer.assist.termSearch.fuel (default: `1800`)::
1313
+
1414
--
15-
Term search fuel in "units of work" for assists (Defaults to 400).
15+
Term search fuel in "units of work" for assists (Defaults to 1800).
1616
--
1717
[[rust-analyzer.cachePriming.enable]]rust-analyzer.cachePriming.enable (default: `true`)::
1818
+
@@ -378,10 +378,10 @@ Custom completion snippets.
378378
--
379379
Whether to enable term search based snippets like `Some(foo.bar().baz())`.
380380
--
381-
[[rust-analyzer.completion.termSearch.fuel]]rust-analyzer.completion.termSearch.fuel (default: `200`)::
381+
[[rust-analyzer.completion.termSearch.fuel]]rust-analyzer.completion.termSearch.fuel (default: `1000`)::
382382
+
383383
--
384-
Term search fuel in "units of work" for autocompletion (Defaults to 200).
384+
Term search fuel in "units of work" for autocompletion (Defaults to 1000).
385385
--
386386
[[rust-analyzer.diagnostics.disabled]]rust-analyzer.diagnostics.disabled (default: `[]`)::
387387
+

editors/code/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,8 @@
592592
"title": "assist",
593593
"properties": {
594594
"rust-analyzer.assist.termSearch.fuel": {
595-
"markdownDescription": "Term search fuel in \"units of work\" for assists (Defaults to 400).",
596-
"default": 400,
595+
"markdownDescription": "Term search fuel in \"units of work\" for assists (Defaults to 1800).",
596+
"default": 1800,
597597
"type": "integer",
598598
"minimum": 0
599599
}
@@ -1224,8 +1224,8 @@
12241224
"title": "completion",
12251225
"properties": {
12261226
"rust-analyzer.completion.termSearch.fuel": {
1227-
"markdownDescription": "Term search fuel in \"units of work\" for autocompletion (Defaults to 200).",
1228-
"default": 200,
1227+
"markdownDescription": "Term search fuel in \"units of work\" for autocompletion (Defaults to 1000).",
1228+
"default": 1000,
12291229
"type": "integer",
12301230
"minimum": 0
12311231
}

0 commit comments

Comments
 (0)