Unconditionally enable location links in inlay hints again

This commit is contained in:
Lukas Wirth 2023-01-16 16:04:38 +01:00
parent 5306eb06cc
commit 3a95864df5
7 changed files with 38 additions and 54 deletions

View file

@ -31,7 +31,6 @@ mod discriminant;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct InlayHintsConfig {
pub location_links: bool,
pub render_colons: bool,
pub type_hints: bool,
pub discriminant_hints: DiscriminantHints,
@ -240,7 +239,6 @@ struct InlayHintLabelBuilder<'a> {
db: &'a RootDatabase,
result: InlayHintLabel,
last_part: String,
location_link_enabled: bool,
location: Option<FileRange>,
}
@ -252,9 +250,6 @@ impl fmt::Write for InlayHintLabelBuilder<'_> {
impl HirWrite for InlayHintLabelBuilder<'_> {
fn start_location_link(&mut self, def: ModuleDefId) {
if !self.location_link_enabled {
return;
}
if self.location.is_some() {
never!("location link is already started");
}
@ -266,9 +261,6 @@ impl HirWrite for InlayHintLabelBuilder<'_> {
}
fn end_location_link(&mut self) {
if !self.location_link_enabled {
return;
}
self.make_new_part();
}
}
@ -334,7 +326,6 @@ fn label_of_ty(
db: sema.db,
last_part: String::new(),
location: None,
location_link_enabled: config.location_links,
result: InlayHintLabel::default(),
};
let _ = rec(sema, famous_defs, config.max_length, ty, &mut label_builder);
@ -495,7 +486,6 @@ mod tests {
use super::ClosureReturnTypeHints;
pub(super) const DISABLED_CONFIG: InlayHintsConfig = InlayHintsConfig {
location_links: false,
discriminant_hints: DiscriminantHints::Never,
render_colons: false,
type_hints: false,
@ -513,8 +503,6 @@ mod tests {
max_length: None,
closing_brace_hints_min_lines: None,
};
pub(super) const DISABLED_CONFIG_WITH_LINKS: InlayHintsConfig =
InlayHintsConfig { location_links: true, ..DISABLED_CONFIG };
pub(super) const TEST_CONFIG: InlayHintsConfig = InlayHintsConfig {
type_hints: true,
parameter_hints: true,
@ -522,7 +510,7 @@ mod tests {
closure_return_type_hints: ClosureReturnTypeHints::WithBlock,
binding_mode_hints: true,
lifetime_elision_hints: LifetimeElisionHints::Always,
..DISABLED_CONFIG_WITH_LINKS
..DISABLED_CONFIG
};
#[track_caller]