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

Commit f2444b2

Browse files
committed
Remove unnecessary Hint suffix on InlayKind variants
1 parent 60075a6 commit f2444b2

File tree

13 files changed

+87
-95
lines changed

13 files changed

+87
-95
lines changed

crates/ide/src/inlay_hints.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,17 @@ pub enum AdjustmentHintsMode {
8686

8787
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
8888
pub enum InlayKind {
89-
BindingModeHint,
90-
ChainingHint,
91-
ClosingBraceHint,
92-
ClosureReturnTypeHint,
93-
GenericParamListHint,
94-
AdjustmentHint,
95-
AdjustmentHintPostfix,
96-
LifetimeHint,
97-
ParameterHint,
98-
TypeHint,
99-
DiscriminantHint,
89+
BindingMode,
90+
Chaining,
91+
ClosingBrace,
92+
ClosureReturnType,
93+
GenericParamList,
94+
Adjustment,
95+
AdjustmentPostfix,
96+
Lifetime,
97+
Parameter,
98+
Type,
99+
Discriminant,
100100
OpeningParenthesis,
101101
ClosingParenthesis,
102102
}

crates/ide/src/inlay_hints/adjustment.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,7 @@ pub(super) fn hints(
9797
};
9898
acc.push(InlayHint {
9999
range: expr.syntax().text_range(),
100-
kind: if postfix {
101-
InlayKind::AdjustmentHintPostfix
102-
} else {
103-
InlayKind::AdjustmentHint
104-
},
100+
kind: if postfix { InlayKind::AdjustmentPostfix } else { InlayKind::Adjustment },
105101
label: if postfix { format!(".{}", text.trim_end()).into() } else { text.into() },
106102
});
107103
}

crates/ide/src/inlay_hints/bind_pat.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub(super) fn hints(
4848
Some(name) => name.syntax().text_range(),
4949
None => pat.syntax().text_range(),
5050
},
51-
kind: InlayKind::TypeHint,
51+
kind: InlayKind::Type,
5252
label,
5353
});
5454

@@ -316,14 +316,14 @@ fn main(a: SliceIter<'_, Container>) {
316316
[
317317
InlayHint {
318318
range: 484..554,
319-
kind: ChainingHint,
319+
kind: Chaining,
320320
label: [
321321
"impl Iterator<Item = impl Iterator<Item = &&str>>",
322322
],
323323
},
324324
InlayHint {
325325
range: 484..485,
326-
kind: ChainingHint,
326+
kind: Chaining,
327327
label: [
328328
"",
329329
InlayHintLabelPart {

crates/ide/src/inlay_hints/binding_mode.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ pub(super) fn hints(
4040
(true, false) => "&",
4141
_ => return,
4242
};
43-
acc.push(InlayHint {
44-
range,
45-
kind: InlayKind::BindingModeHint,
46-
label: r.to_string().into(),
47-
});
43+
acc.push(InlayHint { range, kind: InlayKind::BindingMode, label: r.to_string().into() });
4844
});
4945
match pat {
5046
ast::Pat::IdentPat(pat) if pat.ref_token().is_none() && pat.mut_token().is_none() => {
@@ -56,7 +52,7 @@ pub(super) fn hints(
5652
};
5753
acc.push(InlayHint {
5854
range: pat.syntax().text_range(),
59-
kind: InlayKind::BindingModeHint,
55+
kind: InlayKind::BindingMode,
6056
label: bm.to_string().into(),
6157
});
6258
}

crates/ide/src/inlay_hints/chaining.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub(super) fn hints(
5959
}
6060
acc.push(InlayHint {
6161
range: expr.syntax().text_range(),
62-
kind: InlayKind::ChainingHint,
62+
kind: InlayKind::Chaining,
6363
label: label_of_ty(famous_defs, config, ty)?,
6464
});
6565
}
@@ -110,7 +110,7 @@ fn main() {
110110
[
111111
InlayHint {
112112
range: 147..172,
113-
kind: ChainingHint,
113+
kind: Chaining,
114114
label: [
115115
"",
116116
InlayHintLabelPart {
@@ -130,7 +130,7 @@ fn main() {
130130
},
131131
InlayHint {
132132
range: 147..154,
133-
kind: ChainingHint,
133+
kind: Chaining,
134134
label: [
135135
"",
136136
InlayHintLabelPart {
@@ -195,14 +195,14 @@ fn main() {
195195
[
196196
InlayHint {
197197
range: 143..190,
198-
kind: ChainingHint,
198+
kind: Chaining,
199199
label: [
200200
"C",
201201
],
202202
},
203203
InlayHint {
204204
range: 143..179,
205-
kind: ChainingHint,
205+
kind: Chaining,
206206
label: [
207207
"B",
208208
],
@@ -238,7 +238,7 @@ fn main() {
238238
[
239239
InlayHint {
240240
range: 143..190,
241-
kind: ChainingHint,
241+
kind: Chaining,
242242
label: [
243243
"",
244244
InlayHintLabelPart {
@@ -258,7 +258,7 @@ fn main() {
258258
},
259259
InlayHint {
260260
range: 143..179,
261-
kind: ChainingHint,
261+
kind: Chaining,
262262
label: [
263263
"",
264264
InlayHintLabelPart {
@@ -308,7 +308,7 @@ fn main() {
308308
[
309309
InlayHint {
310310
range: 246..283,
311-
kind: ChainingHint,
311+
kind: Chaining,
312312
label: [
313313
"",
314314
InlayHintLabelPart {
@@ -341,7 +341,7 @@ fn main() {
341341
},
342342
InlayHint {
343343
range: 246..265,
344-
kind: ChainingHint,
344+
kind: Chaining,
345345
label: [
346346
"",
347347
InlayHintLabelPart {
@@ -406,28 +406,28 @@ fn main() {
406406
[
407407
InlayHint {
408408
range: 174..241,
409-
kind: ChainingHint,
409+
kind: Chaining,
410410
label: [
411411
"impl Iterator<Item = ()>",
412412
],
413413
},
414414
InlayHint {
415415
range: 174..224,
416-
kind: ChainingHint,
416+
kind: Chaining,
417417
label: [
418418
"impl Iterator<Item = ()>",
419419
],
420420
},
421421
InlayHint {
422422
range: 174..206,
423-
kind: ChainingHint,
423+
kind: Chaining,
424424
label: [
425425
"impl Iterator<Item = ()>",
426426
],
427427
},
428428
InlayHint {
429429
range: 174..189,
430-
kind: ChainingHint,
430+
kind: Chaining,
431431
label: [
432432
"&mut ",
433433
InlayHintLabelPart {
@@ -476,7 +476,7 @@ fn main() {
476476
[
477477
InlayHint {
478478
range: 124..130,
479-
kind: TypeHint,
479+
kind: Type,
480480
label: [
481481
"",
482482
InlayHintLabelPart {
@@ -496,7 +496,7 @@ fn main() {
496496
},
497497
InlayHint {
498498
range: 145..185,
499-
kind: ChainingHint,
499+
kind: Chaining,
500500
label: [
501501
"",
502502
InlayHintLabelPart {
@@ -516,7 +516,7 @@ fn main() {
516516
},
517517
InlayHint {
518518
range: 145..168,
519-
kind: ChainingHint,
519+
kind: Chaining,
520520
label: [
521521
"",
522522
InlayHintLabelPart {
@@ -536,7 +536,7 @@ fn main() {
536536
},
537537
InlayHint {
538538
range: 222..228,
539-
kind: ParameterHint,
539+
kind: Parameter,
540540
label: [
541541
InlayHintLabelPart {
542542
text: "self",

crates/ide/src/inlay_hints/closing_brace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub(super) fn hints(
113113
.flatten();
114114
acc.push(InlayHint {
115115
range: closing_token.text_range(),
116-
kind: InlayKind::ClosingBraceHint,
116+
kind: InlayKind::ClosingBrace,
117117
label: InlayHintLabel::simple(label, None, linked_location),
118118
});
119119

crates/ide/src/inlay_hints/closure_ret.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub(super) fn hints(
4141
}
4242
acc.push(InlayHint {
4343
range: param_list.syntax().text_range(),
44-
kind: InlayKind::ClosureReturnTypeHint,
44+
kind: InlayKind::ClosureReturnType,
4545
label: label_of_ty(famous_defs, config, ty)?,
4646
});
4747
Some(())

crates/ide/src/inlay_hints/discriminant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub(super) fn hints(
4343
Some(field_list) => name.syntax().text_range().cover(field_list.syntax().text_range()),
4444
None => name.syntax().text_range(),
4545
},
46-
kind: InlayKind::DiscriminantHint,
46+
kind: InlayKind::Discriminant,
4747
label: InlayHintLabel::simple(
4848
match &d {
4949
Ok(v) => format!("{}", v),

crates/ide/src/inlay_hints/fn_lifetime_fn.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub(super) fn hints(
2323

2424
let mk_lt_hint = |t: SyntaxToken, label: String| InlayHint {
2525
range: t.text_range(),
26-
kind: InlayKind::LifetimeHint,
26+
kind: InlayKind::Lifetime,
2727
label: label.into(),
2828
};
2929

@@ -182,7 +182,7 @@ pub(super) fn hints(
182182
let is_empty = gpl.generic_params().next().is_none();
183183
acc.push(InlayHint {
184184
range: angle_tok.text_range(),
185-
kind: InlayKind::LifetimeHint,
185+
kind: InlayKind::Lifetime,
186186
label: format!(
187187
"{}{}",
188188
allocated_lifetimes.iter().format(", "),
@@ -193,7 +193,7 @@ pub(super) fn hints(
193193
}
194194
(None, allocated_lifetimes) => acc.push(InlayHint {
195195
range: func.name()?.syntax().text_range(),
196-
kind: InlayKind::GenericParamListHint,
196+
kind: InlayKind::GenericParamList,
197197
label: format!("<{}>", allocated_lifetimes.iter().format(", "),).into(),
198198
}),
199199
}

crates/ide/src/inlay_hints/implicit_static.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub(super) fn hints(
3232
let t = ty.amp_token()?;
3333
acc.push(InlayHint {
3434
range: t.text_range(),
35-
kind: InlayKind::LifetimeHint,
35+
kind: InlayKind::Lifetime,
3636
label: "'static".to_owned().into(),
3737
});
3838
}

crates/ide/src/inlay_hints/param_name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub(super) fn hints(
5555

5656
InlayHint {
5757
range,
58-
kind: InlayKind::ParameterHint,
58+
kind: InlayKind::Parameter,
5959
label: InlayHintLabel::simple(param_name, None, linked_location),
6060
}
6161
});

0 commit comments

Comments
 (0)