Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 198c075

Browse files
committed
Auto merge of rust-lang#12083 - Veykril:inlays, r=Veykril
minor: Add test for parameter and reborrow hint order
2 parents a8bc625 + 5e41399 commit 198c075

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

crates/ide/src/inlay_hints.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ pub enum LifetimeElisionHints {
3636

3737
#[derive(Clone, Debug, PartialEq, Eq)]
3838
pub enum InlayKind {
39-
ImplicitReborrow,
40-
TypeHint,
41-
ParameterHint,
42-
ClosureReturnTypeHint,
4339
ChainingHint,
40+
ClosureReturnTypeHint,
4441
GenericParamListHint,
42+
ImplicitReborrow,
4543
LifetimeHint,
44+
ParameterHint,
45+
TypeHint,
4646
}
4747

4848
#[derive(Debug)]
@@ -110,11 +110,11 @@ fn hints(
110110
config: &InlayHintsConfig,
111111
node: SyntaxNode,
112112
) {
113-
let krate = match sema.scope(&node) {
114-
Some(it) => it.krate(),
113+
let famous_defs = match sema.scope(&node) {
114+
Some(it) => FamousDefs(sema, it.krate()),
115115
None => return,
116116
};
117-
let famous_defs = FamousDefs(sema, krate);
117+
118118
if let Some(expr) = ast::Expr::cast(node.clone()) {
119119
chaining_hints(hints, sema, &famous_defs, config, &expr);
120120
match expr {
@@ -1637,10 +1637,7 @@ fn main() {
16371637
fn skip_constructor_and_enum_type_hints() {
16381638
check_with_config(
16391639
InlayHintsConfig {
1640-
render_colons: true,
16411640
type_hints: true,
1642-
parameter_hints: true,
1643-
chaining_hints: true,
16441641
hide_named_constructor_hints: true,
16451642
..DISABLED_CONFIG
16461643
},
@@ -2147,33 +2144,36 @@ impl () {
21472144
#[test]
21482145
fn hints_implicit_reborrow() {
21492146
check_with_config(
2150-
InlayHintsConfig { reborrow_hints: true, ..DISABLED_CONFIG },
2147+
InlayHintsConfig { reborrow_hints: true, parameter_hints: true, ..DISABLED_CONFIG },
21512148
r#"
21522149
fn __() {
21532150
let unique = &mut ();
21542151
let r_mov = unique;
21552152
let foo: &mut _ = unique;
21562153
//^^^^^^ &mut *
21572154
ref_mut_id(unique);
2155+
//^^^^^^ mut_ref
21582156
//^^^^^^ &mut *
21592157
let shared = ref_id(unique);
2158+
//^^^^^^ shared_ref
21602159
//^^^^^^ &*
21612160
let mov = shared;
21622161
let r_mov: &_ = shared;
21632162
ref_id(shared);
2163+
//^^^^^^ shared_ref
21642164
21652165
identity(unique);
21662166
identity(shared);
21672167
}
21682168
fn identity<T>(t: T) -> T {
21692169
t
21702170
}
2171-
fn ref_mut_id(x: &mut ()) -> &mut () {
2172-
x
2173-
//^ &mut *
2171+
fn ref_mut_id(mut_ref: &mut ()) -> &mut () {
2172+
mut_ref
2173+
//^^^^^^^ &mut *
21742174
}
2175-
fn ref_id(x: &()) -> &() {
2176-
x
2175+
fn ref_id(shared_ref: &()) -> &() {
2176+
shared_ref
21772177
}
21782178
"#,
21792179
);

0 commit comments

Comments
 (0)