diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-07-29 08:13:50 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-07-29 08:26:52 +1000 |
| commit | 84ac80f1921afc243d71fd0caaa4f2838c294102 (patch) | |
| tree | 29006db815bf547dfd0129910b23b8c54675bd98 /src/librustdoc/html/render | |
| parent | 118f9350c5b902e462a6dcc4325670f3da701600 (diff) | |
| download | rust-84ac80f1921afc243d71fd0caaa4f2838c294102.tar.gz rust-84ac80f1921afc243d71fd0caaa4f2838c294102.zip | |
Reformat `use` declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
Diffstat (limited to 'src/librustdoc/html/render')
| -rw-r--r-- | src/librustdoc/html/render/context.rs | 13 | ||||
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 20 | ||||
| -rw-r--r-- | src/librustdoc/html/render/print_item.rs | 14 | ||||
| -rw-r--r-- | src/librustdoc/html/render/search_index.rs | 3 | ||||
| -rw-r--r-- | src/librustdoc/html/render/sidebar.rs | 17 | ||||
| -rw-r--r-- | src/librustdoc/html/render/span_map.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/html/render/type_layout.rs | 8 |
7 files changed, 36 insertions, 45 deletions
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs index 7718413c956..0334eacc161 100644 --- a/src/librustdoc/html/render/context.rs +++ b/src/librustdoc/html/render/context.rs @@ -5,6 +5,7 @@ use std::path::{Path, PathBuf}; use std::rc::Rc; use std::sync::mpsc::{channel, Receiver}; +use rinja::Template; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir::def_id::{DefIdMap, LOCAL_CRATE}; use rustc_middle::ty::TyCtxt; @@ -14,15 +15,12 @@ use rustc_span::{sym, FileName, Symbol}; use super::print_item::{full_path, item_path, print_item}; use super::search_index::build_index; +use super::sidebar::{print_sidebar, sidebar_module_like, Sidebar}; use super::write_shared::write_shared; -use super::{ - collect_spans_and_sources, scrape_examples_help, - sidebar::print_sidebar, - sidebar::{sidebar_module_like, Sidebar}, - AllTypes, LinkFromSrc, StylePath, -}; +use super::{collect_spans_and_sources, scrape_examples_help, AllTypes, LinkFromSrc, StylePath}; +use crate::clean::types::ExternalLocation; use crate::clean::utils::has_doc_flag; -use crate::clean::{self, types::ExternalLocation, ExternalCrate}; +use crate::clean::{self, ExternalCrate}; use crate::config::{ModuleSorting, RenderOptions}; use crate::docfs::{DocFS, PathError}; use crate::error::Error; @@ -36,7 +34,6 @@ use crate::html::url_parts_builder::UrlPartsBuilder; use crate::html::{layout, sources, static_files}; use crate::scrape_examples::AllCallLocations; use crate::try_err; -use rinja::Template; /// Major driving force in all rustdoc rendering. This contains information /// about where in the tree-like hierarchy rendering is occurring and controls diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 47712264e97..aaac8678264 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -35,16 +35,12 @@ mod span_map; mod type_layout; mod write_shared; -pub(crate) use self::context::*; -pub(crate) use self::span_map::{collect_spans_and_sources, LinkFromSrc}; - use std::collections::VecDeque; use std::fmt::{self, Write}; -use std::fs; use std::iter::Peekable; use std::path::PathBuf; use std::rc::Rc; -use std::str; +use std::{fs, str}; use rinja::Template; use rustc_attr::{ConstStability, DeprecatedSince, Deprecation, StabilityLevel, StableSince}; @@ -55,13 +51,13 @@ use rustc_hir::Mutability; use rustc_middle::ty::print::PrintTraitRefExt; use rustc_middle::ty::{self, TyCtxt}; use rustc_session::RustcVersion; -use rustc_span::{ - symbol::{sym, Symbol}, - BytePos, FileName, RealFileName, DUMMY_SP, -}; +use rustc_span::symbol::{sym, Symbol}; +use rustc_span::{BytePos, FileName, RealFileName, DUMMY_SP}; use serde::ser::SerializeMap; use serde::{Serialize, Serializer}; +pub(crate) use self::context::*; +pub(crate) use self::span_map::{collect_spans_and_sources, LinkFromSrc}; use crate::clean::{self, ItemId, RenderedLink, SelfTy}; use crate::error::Error; use crate::formats::cache::Cache; @@ -73,15 +69,13 @@ use crate::html::format::{ print_default_space, print_generic_bounds, print_where_clause, visibility_print_with_space, Buffer, Ending, HrefError, PrintWithSpace, }; -use crate::html::highlight; use crate::html::markdown::{ HeadingOffset, IdMap, Markdown, MarkdownItemInfo, MarkdownSummaryLine, }; -use crate::html::sources; use crate::html::static_files::SCRAPE_EXAMPLES_HELP_MD; +use crate::html::{highlight, sources}; use crate::scrape_examples::{CallData, CallLocation}; -use crate::try_none; -use crate::DOC_RUST_LANG_ORG_CHANNEL; +use crate::{try_none, DOC_RUST_LANG_ORG_CHANNEL}; pub(crate) fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ { crate::html::format::display_fn(move |f| { diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 0cf62ccf6e7..24476e80778 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -1,3 +1,10 @@ +use std::cell::{RefCell, RefMut}; +use std::cmp::Ordering; +use std::fmt; +use std::rc::Rc; + +use itertools::Itertools; +use rinja::Template; use rustc_data_structures::captures::Captures; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; @@ -8,10 +15,6 @@ use rustc_middle::ty::{self, TyCtxt}; use rustc_span::hygiene::MacroKind; use rustc_span::symbol::{kw, sym, Symbol}; use rustc_target::abi::VariantIdx; -use std::cell::{RefCell, RefMut}; -use std::cmp::Ordering; -use std::fmt; -use std::rc::Rc; use super::type_layout::document_type_layout; use super::{ @@ -36,9 +39,6 @@ use crate::html::markdown::{HeadingOffset, MarkdownSummaryLine}; use crate::html::render::{document_full, document_item_info}; use crate::html::url_parts_builder::UrlPartsBuilder; -use itertools::Itertools; -use rinja::Template; - /// Generates a Rinja template struct for rendering items with common methods. /// /// Usage: diff --git a/src/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs index 66d3f0fd8ce..b3f4d82e054 100644 --- a/src/librustdoc/html/render/search_index.rs +++ b/src/librustdoc/html/render/search_index.rs @@ -3,6 +3,7 @@ pub(crate) mod encode; use std::collections::hash_map::Entry; use std::collections::{BTreeMap, VecDeque}; +use encode::{bitmap_to_string, write_vlqhex_to_string}; use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; use rustc_middle::ty::TyCtxt; use rustc_span::def_id::DefId; @@ -19,8 +20,6 @@ use crate::html::format::join_with_double_colon; use crate::html::markdown::short_markdown_summary; use crate::html::render::{self, IndexItem, IndexItemFunctionType, RenderType, RenderTypeId}; -use encode::{bitmap_to_string, write_vlqhex_to_string}; - /// The serialized search description sharded version /// /// The `index` is a JSON-encoded list of names and other information. diff --git a/src/librustdoc/html/render/sidebar.rs b/src/librustdoc/html/render/sidebar.rs index e5bc2ace203..6e826446c0e 100644 --- a/src/librustdoc/html/render/sidebar.rs +++ b/src/librustdoc/html/render/sidebar.rs @@ -1,17 +1,18 @@ -use std::{borrow::Cow, rc::Rc}; +use std::borrow::Cow; +use std::rc::Rc; use rinja::Template; use rustc_data_structures::fx::FxHashSet; -use rustc_hir::{def::CtorKind, def_id::DefIdSet}; +use rustc_hir::def::CtorKind; +use rustc_hir::def_id::DefIdSet; use rustc_middle::ty::{self, TyCtxt}; -use crate::{ - clean, - formats::{item_type::ItemType, Impl}, - html::{format::Buffer, markdown::IdMap}, -}; - use super::{item_ty_to_section, Context, ItemSection}; +use crate::clean; +use crate::formats::item_type::ItemType; +use crate::formats::Impl; +use crate::html::format::Buffer; +use crate::html::markdown::IdMap; #[derive(Template)] #[template(path = "sidebar.html")] diff --git a/src/librustdoc/html/render/span_map.rs b/src/librustdoc/html/render/span_map.rs index 0535246ae10..5b53277c059 100644 --- a/src/librustdoc/html/render/span_map.rs +++ b/src/librustdoc/html/render/span_map.rs @@ -1,5 +1,4 @@ -use crate::clean::{self, rustc_span, PrimitiveType}; -use crate::html::sources; +use std::path::{Path, PathBuf}; use rustc_data_structures::fx::FxHashMap; use rustc_hir::def::{DefKind, Res}; @@ -11,7 +10,8 @@ use rustc_middle::ty::TyCtxt; use rustc_span::hygiene::MacroKind; use rustc_span::{BytePos, ExpnKind, Span}; -use std::path::{Path, PathBuf}; +use crate::clean::{self, rustc_span, PrimitiveType}; +use crate::html::sources; /// This enum allows us to store two different kinds of information: /// diff --git a/src/librustdoc/html/render/type_layout.rs b/src/librustdoc/html/render/type_layout.rs index 35a38d5375f..cd4e597ff28 100644 --- a/src/librustdoc/html/render/type_layout.rs +++ b/src/librustdoc/html/render/type_layout.rs @@ -1,14 +1,14 @@ -use rinja::Template; +use std::fmt; +use rinja::Template; use rustc_data_structures::captures::Captures; use rustc_hir::def_id::DefId; use rustc_middle::span_bug; -use rustc_middle::ty::{self, layout::LayoutError}; +use rustc_middle::ty::layout::LayoutError; +use rustc_middle::ty::{self}; use rustc_span::symbol::Symbol; use rustc_target::abi::{Primitive, TagEncoding, Variants}; -use std::fmt; - use crate::html::format::display_fn; use crate::html::render::Context; |
