Skip to content

Commit 69a79ce

Browse files
committed
rustdoc: Move AssocItemRender and RenderMode to html::render.
They're only used for HTML, so it makes more sense for them to live their.
1 parent 5facb42 commit 69a79ce

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

Diff for: src/librustdoc/formats/mod.rs

-15
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,6 @@ pub(crate) use renderer::{run_format, FormatRenderer};
99
use crate::clean::{self, ItemId};
1010
use crate::html::render::Context;
1111

12-
/// Specifies whether rendering directly implemented trait items or ones from a certain Deref
13-
/// impl.
14-
pub(crate) enum AssocItemRender<'a> {
15-
All,
16-
DerefFor { trait_: &'a clean::Path, type_: &'a clean::Type, deref_mut_: bool },
17-
}
18-
19-
/// For different handling of associated items from the Deref target of a type rather than the type
20-
/// itself.
21-
#[derive(Copy, Clone, PartialEq)]
22-
pub(crate) enum RenderMode {
23-
Normal,
24-
ForDeref { mut_: bool },
25-
}
26-
2712
/// Metadata about implementations for a type or trait.
2813
#[derive(Clone, Debug)]
2914
pub(crate) struct Impl {

Diff for: src/librustdoc/html/render/mod.rs

+16-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ use crate::clean::{self, ItemId, RenderedLink, SelfTy};
6666
use crate::error::Error;
6767
use crate::formats::cache::Cache;
6868
use crate::formats::item_type::ItemType;
69-
use crate::formats::{AssocItemRender, Impl, RenderMode};
69+
use crate::formats::Impl;
7070
use crate::html::escape::Escape;
7171
use crate::html::format::{
7272
display_fn, href, join_with_double_colon, print_abi_with_space, print_constness_with_space,
@@ -89,6 +89,21 @@ pub(crate) fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ {
8989
})
9090
}
9191

92+
/// Specifies whether rendering directly implemented trait items or ones from a certain Deref
93+
/// impl.
94+
pub(crate) enum AssocItemRender<'a> {
95+
All,
96+
DerefFor { trait_: &'a clean::Path, type_: &'a clean::Type, deref_mut_: bool },
97+
}
98+
99+
/// For different handling of associated items from the Deref target of a type rather than the type
100+
/// itself.
101+
#[derive(Copy, Clone, PartialEq)]
102+
pub(crate) enum RenderMode {
103+
Normal,
104+
ForDeref { mut_: bool },
105+
}
106+
92107
// Helper structs for rendering items/sidebars and carrying along contextual
93108
// information
94109

Diff for: src/librustdoc/html/render/print_item.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ use super::{
2222
item_ty_to_section, notable_traits_button, notable_traits_json, render_all_impls,
2323
render_assoc_item, render_assoc_items, render_attributes_in_code, render_attributes_in_pre,
2424
render_impl, render_rightside, render_stability_since_raw,
25-
render_stability_since_raw_with_extra, AssocItemLink, Context, ImplRenderingParameters,
25+
render_stability_since_raw_with_extra, AssocItemLink, AssocItemRender, Context,
26+
ImplRenderingParameters, RenderMode,
2627
};
2728
use crate::clean;
2829
use crate::config::ModuleSorting;
2930
use crate::formats::item_type::ItemType;
30-
use crate::formats::{AssocItemRender, Impl, RenderMode};
31+
use crate::formats::Impl;
3132
use crate::html::escape::Escape;
3233
use crate::html::format::{
3334
display_fn, join_with_double_colon, print_abi_with_space, print_constness_with_space,

Diff for: src/librustdoc/html/render/write_shared.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ use rustc_span::Symbol;
1515
use serde::ser::SerializeSeq;
1616
use serde::{Serialize, Serializer};
1717

18-
use super::{collect_paths_for_type, ensure_trailing_slash, Context};
18+
use super::{collect_paths_for_type, ensure_trailing_slash, Context, RenderMode};
1919
use crate::clean::{Crate, Item, ItemId, ItemKind};
2020
use crate::config::{EmitType, RenderOptions};
2121
use crate::docfs::PathError;
2222
use crate::error::Error;
2323
use crate::formats::cache::Cache;
2424
use crate::formats::item_type::ItemType;
25-
use crate::formats::{Impl, RenderMode};
25+
use crate::formats::Impl;
2626
use crate::html::format::Buffer;
2727
use crate::html::render::{AssocItemLink, ImplRenderingParameters};
2828
use crate::html::{layout, static_files};

0 commit comments

Comments
 (0)