Skip to content

Commit 4b8f51c

Browse files
committed
Update tests and docs for hover_show_adtFieldsOrVariants
1 parent 281faa9 commit 4b8f51c

File tree

5 files changed

+235
-59
lines changed

5 files changed

+235
-59
lines changed

crates/hir/src/display.rs

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,7 @@ impl HirDisplay for Struct {
188188
StructKind::Record => {
189189
let has_where_clause = write_where_clause(def_id, f)?;
190190
if let Some(limit) = f.entity_limit {
191-
display_fields_or_variants(
192-
&self.fields(f.db),
193-
has_where_clause,
194-
limit,
195-
f,
196-
)?;
191+
display_fields_or_variants(&self.fields(f.db), has_where_clause, limit, f)?;
197192
}
198193
}
199194
StructKind::Unit => _ = write_where_clause(def_id, f)?,
@@ -213,12 +208,7 @@ impl HirDisplay for Enum {
213208

214209
let has_where_clause = write_where_clause(def_id, f)?;
215210
if let Some(limit) = f.entity_limit {
216-
display_fields_or_variants(
217-
&self.variants(f.db),
218-
has_where_clause,
219-
limit,
220-
f,
221-
)?;
211+
display_fields_or_variants(&self.variants(f.db), has_where_clause, limit, f)?;
222212
}
223213

224214
Ok(())
@@ -235,12 +225,7 @@ impl HirDisplay for Union {
235225

236226
let has_where_clause = write_where_clause(def_id, f)?;
237227
if let Some(limit) = f.entity_limit {
238-
display_fields_or_variants(
239-
&self.fields(f.db),
240-
has_where_clause,
241-
limit,
242-
f,
243-
)?;
228+
display_fields_or_variants(&self.fields(f.db), has_where_clause, limit, f)?;
244229
}
245230
Ok(())
246231
}
@@ -251,7 +236,7 @@ fn display_fields_or_variants<T: HirDisplay>(
251236
has_where_clause: bool,
252237
limit: usize,
253238
f: &mut HirFormatter<'_>,
254-
)-> Result<(), HirDisplayError> {
239+
) -> Result<(), HirDisplayError> {
255240
let count = fields_or_variants.len().min(limit);
256241
f.write_char(if !has_where_clause { ' ' } else { '\n' })?;
257242
if count == 0 {

0 commit comments

Comments
 (0)