@@ -5,10 +5,12 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
55use rustc_hir as hir;
66use rustc_hir:: def:: CtorKind ;
77use rustc_hir:: def_id:: DefId ;
8+ use rustc_index:: IndexVec ;
89use rustc_middle:: middle:: stability;
910use rustc_middle:: ty:: { self , TyCtxt } ;
1011use rustc_span:: hygiene:: MacroKind ;
1112use rustc_span:: symbol:: { kw, sym, Symbol } ;
13+ use rustc_target:: abi:: VariantIdx ;
1214use std:: cell:: { RefCell , RefMut } ;
1315use std:: cmp:: Ordering ;
1416use std:: fmt;
@@ -1442,9 +1444,7 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
14421444
14431445/// It'll return true if all variants are C-like variants and if at least one of them has a value
14441446/// set.
1445- fn should_show_c_like_variants_value (
1446- variants : & rustc_index:: IndexVec < rustc_target:: abi:: VariantIdx , clean:: Item > ,
1447- ) -> bool {
1447+ fn should_show_enum_discriminant ( variants : & IndexVec < VariantIdx , clean:: Item > ) -> bool {
14481448 let mut has_variants_with_value = false ;
14491449 for variant in variants {
14501450 if let clean:: VariantItem ( ref var) = * variant. kind &&
@@ -1463,14 +1463,14 @@ fn display_c_like_variant(
14631463 cx : & mut Context < ' _ > ,
14641464 item : & clean:: Item ,
14651465 variant : & clean:: Variant ,
1466- index : rustc_target :: abi :: VariantIdx ,
1467- should_show_c_like_variants_value : bool ,
1466+ index : VariantIdx ,
1467+ should_show_enum_discriminant : bool ,
14681468 enum_def_id : DefId ,
14691469) {
14701470 let name = item. name . unwrap ( ) ;
14711471 if let Some ( ref value) = variant. discriminant {
14721472 write ! ( w, "{} = {}" , name. as_str( ) , value. value( cx. tcx( ) , true ) ) ;
1473- } else if should_show_c_like_variants_value {
1473+ } else if should_show_enum_discriminant {
14741474 let adt_def = cx. tcx ( ) . adt_def ( enum_def_id) ;
14751475 let discr = adt_def. discriminant_for_variant ( cx. tcx ( ) , index) ;
14761476 if discr. ty . is_signed ( ) {
@@ -1487,13 +1487,13 @@ fn render_enum_fields(
14871487 mut w : & mut Buffer ,
14881488 cx : & mut Context < ' _ > ,
14891489 g : Option < & clean:: Generics > ,
1490- variants : & rustc_index :: IndexVec < rustc_target :: abi :: VariantIdx , clean:: Item > ,
1490+ variants : & IndexVec < VariantIdx , clean:: Item > ,
14911491 count_variants : usize ,
14921492 has_stripped_entries : bool ,
14931493 is_non_exhaustive : bool ,
14941494 enum_def_id : DefId ,
14951495) {
1496- let should_show_c_like_variants_value = should_show_c_like_variants_value ( variants) ;
1496+ let should_show_enum_discriminant = should_show_enum_discriminant ( variants) ;
14971497 if !g. is_some_and ( |g| print_where_clause_and_check ( w, g, cx) ) {
14981498 // If there wasn't a `where` clause, we add a whitespace.
14991499 w. write_str ( " " ) ;
@@ -1522,7 +1522,7 @@ fn render_enum_fields(
15221522 v,
15231523 var,
15241524 index,
1525- should_show_c_like_variants_value ,
1525+ should_show_enum_discriminant ,
15261526 enum_def_id,
15271527 ) ,
15281528 clean:: VariantKind :: Tuple ( ref s) => {
@@ -1551,7 +1551,7 @@ fn item_variants(
15511551 w : & mut Buffer ,
15521552 cx : & mut Context < ' _ > ,
15531553 it : & clean:: Item ,
1554- variants : & rustc_index :: IndexVec < rustc_target :: abi :: VariantIdx , clean:: Item > ,
1554+ variants : & IndexVec < VariantIdx , clean:: Item > ,
15551555) {
15561556 let tcx = cx. tcx ( ) ;
15571557 write ! (
@@ -1564,7 +1564,7 @@ fn item_variants(
15641564 document_non_exhaustive_header( it) ,
15651565 document_non_exhaustive( it)
15661566 ) ;
1567- let should_show_c_like_variants_value = should_show_c_like_variants_value ( variants) ;
1567+ let should_show_enum_discriminant = should_show_enum_discriminant ( variants) ;
15681568 for ( index, variant) in variants. iter_enumerated ( ) {
15691569 if variant. is_stripped ( ) {
15701570 continue ;
@@ -1593,7 +1593,7 @@ fn item_variants(
15931593 variant,
15941594 var,
15951595 index,
1596- should_show_c_like_variants_value ,
1596+ should_show_enum_discriminant ,
15971597 it. def_id ( ) . unwrap ( ) ,
15981598 ) ;
15991599 } else {
0 commit comments