diff options
| author | Michael Goulet <michael@errs.io> | 2024-09-22 19:05:04 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-09-22 19:11:29 -0400 |
| commit | c682aa162b0d41e21cc6748f4fecfe01efb69d1f (patch) | |
| tree | 0c31b640e3faacfb187a1509e3da5d5b6ba0109c /src/librustdoc/html | |
| parent | 1173204b364841b51598744fc69d7c80be10f956 (diff) | |
| download | rust-c682aa162b0d41e21cc6748f4fecfe01efb69d1f.tar.gz rust-c682aa162b0d41e21cc6748f4fecfe01efb69d1f.zip | |
Reformat using the new identifier sorting from rustfmt
Diffstat (limited to 'src/librustdoc/html')
| -rw-r--r-- | src/librustdoc/html/format.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/highlight.rs | 44 | ||||
| -rw-r--r-- | src/librustdoc/html/highlight/tests.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/layout.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/markdown.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/markdown/tests.rs | 22 | ||||
| -rw-r--r-- | src/librustdoc/html/render/context.rs | 14 | ||||
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 18 | ||||
| -rw-r--r-- | src/librustdoc/html/render/print_item.rs | 12 | ||||
| -rw-r--r-- | src/librustdoc/html/render/search_index.rs | 11 | ||||
| -rw-r--r-- | src/librustdoc/html/render/sidebar.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/render/span_map.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/render/write_shared.rs | 10 | ||||
| -rw-r--r-- | src/librustdoc/html/sources.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/tests.rs | 2 |
15 files changed, 73 insertions, 82 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index cf362272d7d..2e70a8c080d 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -22,12 +22,12 @@ use rustc_metadata::creader::{CStore, LoadedMacro}; use rustc_middle::ty; use rustc_middle::ty::TyCtxt; use rustc_span::symbol::kw; -use rustc_span::{sym, Symbol}; +use rustc_span::{Symbol, sym}; use rustc_target::spec::abi::Abi; use tracing::{debug, trace}; use {rustc_ast as ast, rustc_hir as hir}; -use super::url_parts_builder::{estimate_item_path_byte_length, UrlPartsBuilder}; +use super::url_parts_builder::{UrlPartsBuilder, estimate_item_path_byte_length}; use crate::clean::types::ExternalLocation; use crate::clean::utils::find_nearest_parent_module; use crate::clean::{self, ExternalCrate, PrimitiveType}; diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index e728da67dc2..69b3421f888 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -12,7 +12,7 @@ use rustc_data_structures::fx::FxHashMap; use rustc_lexer::{Cursor, LiteralKind, TokenKind}; use rustc_span::edition::Edition; use rustc_span::symbol::Symbol; -use rustc_span::{BytePos, Span, DUMMY_SP}; +use rustc_span::{BytePos, DUMMY_SP, Span}; use super::format::{self, Buffer}; use crate::clean::PrimitiveType; @@ -72,34 +72,26 @@ fn write_header( tooltip: Tooltip, extra_classes: &[String], ) { - write!( - out, - "<div class=\"example-wrap{}\">", - match tooltip { - Tooltip::Ignore => " ignore", - Tooltip::CompileFail => " compile_fail", - Tooltip::ShouldPanic => " should_panic", - Tooltip::Edition(_) => " edition", - Tooltip::None => "", - }, - ); + write!(out, "<div class=\"example-wrap{}\">", match tooltip { + Tooltip::Ignore => " ignore", + Tooltip::CompileFail => " compile_fail", + Tooltip::ShouldPanic => " should_panic", + Tooltip::Edition(_) => " edition", + Tooltip::None => "", + },); if tooltip != Tooltip::None { let edition_code; - write!( - out, - "<a href=\"#\" class=\"tooltip\" title=\"{}\">ⓘ</a>", - match tooltip { - Tooltip::Ignore => "This example is not tested", - Tooltip::CompileFail => "This example deliberately fails to compile", - Tooltip::ShouldPanic => "This example panics", - Tooltip::Edition(edition) => { - edition_code = format!("This example runs with edition {edition}"); - &edition_code - } - Tooltip::None => unreachable!(), - }, - ); + write!(out, "<a href=\"#\" class=\"tooltip\" title=\"{}\">ⓘ</a>", match tooltip { + Tooltip::Ignore => "This example is not tested", + Tooltip::CompileFail => "This example deliberately fails to compile", + Tooltip::ShouldPanic => "This example panics", + Tooltip::Edition(edition) => { + edition_code = format!("This example runs with edition {edition}"); + &edition_code + } + Tooltip::None => unreachable!(), + },); } if let Some(extra) = extra_content { diff --git a/src/librustdoc/html/highlight/tests.rs b/src/librustdoc/html/highlight/tests.rs index 9d511018dec..75328e724fe 100644 --- a/src/librustdoc/html/highlight/tests.rs +++ b/src/librustdoc/html/highlight/tests.rs @@ -2,7 +2,7 @@ use expect_test::expect_file; use rustc_data_structures::fx::FxHashMap; use rustc_span::create_default_session_globals_then; -use super::{write_code, DecorationInfo}; +use super::{DecorationInfo, write_code}; use crate::html::format::Buffer; const STYLE: &str = r#" diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index 780cda9b1cd..3684dc42ac7 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -3,10 +3,10 @@ use std::path::PathBuf; use rinja::Template; use rustc_data_structures::fx::FxHashMap; -use super::static_files::{StaticFiles, STATIC_FILES}; +use super::static_files::{STATIC_FILES, StaticFiles}; use crate::externalfiles::ExternalHtml; use crate::html::format::{Buffer, Print}; -use crate::html::render::{ensure_trailing_slash, StylePath}; +use crate::html::render::{StylePath, ensure_trailing_slash}; #[derive(Clone)] pub(crate) struct Layout { diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 050ba60318e..b18d621478c 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -35,8 +35,8 @@ use std::str::{self, CharIndices}; use std::sync::OnceLock; use pulldown_cmark::{ - html, BrokenLink, BrokenLinkCallback, CodeBlockKind, CowStr, Event, LinkType, OffsetIter, - Options, Parser, Tag, TagEnd, + BrokenLink, BrokenLinkCallback, CodeBlockKind, CowStr, Event, LinkType, OffsetIter, Options, + Parser, Tag, TagEnd, html, }; use rustc_data_structures::fx::FxHashMap; use rustc_errors::{Diag, DiagMessage}; diff --git a/src/librustdoc/html/markdown/tests.rs b/src/librustdoc/html/markdown/tests.rs index 3ec60c0efd2..2001a763c09 100644 --- a/src/librustdoc/html/markdown/tests.rs +++ b/src/librustdoc/html/markdown/tests.rs @@ -1,8 +1,8 @@ -use rustc_span::edition::{Edition, DEFAULT_EDITION}; +use rustc_span::edition::{DEFAULT_EDITION, Edition}; use super::{ - find_testable_code, plain_text_summary, short_markdown_summary, ErrorCodes, HeadingOffset, - IdMap, Ignore, LangString, LangStringToken, Markdown, MarkdownItemInfo, TagIterator, + ErrorCodes, HeadingOffset, IdMap, Ignore, LangString, LangStringToken, Markdown, + MarkdownItemInfo, TagIterator, find_testable_code, plain_text_summary, short_markdown_summary, }; #[test] @@ -275,14 +275,14 @@ fn test_lang_string_tokenizer() { case("foo", &[LangStringToken::LangToken("foo")]); case("foo,bar", &[LangStringToken::LangToken("foo"), LangStringToken::LangToken("bar")]); case(".foo,.bar", &[]); - case( - "{.foo,.bar}", - &[LangStringToken::ClassAttribute("foo"), LangStringToken::ClassAttribute("bar")], - ); - case( - " {.foo,.bar} ", - &[LangStringToken::ClassAttribute("foo"), LangStringToken::ClassAttribute("bar")], - ); + case("{.foo,.bar}", &[ + LangStringToken::ClassAttribute("foo"), + LangStringToken::ClassAttribute("bar"), + ]); + case(" {.foo,.bar} ", &[ + LangStringToken::ClassAttribute("foo"), + LangStringToken::ClassAttribute("bar"), + ]); case("foo bar", &[LangStringToken::LangToken("foo"), LangStringToken::LangToken("bar")]); case("foo\tbar", &[LangStringToken::LangToken("foo"), LangStringToken::LangToken("bar")]); case("foo\t, bar", &[LangStringToken::LangToken("foo"), LangStringToken::LangToken("bar")]); diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs index a9b9377c0b9..bce3f218908 100644 --- a/src/librustdoc/html/render/context.rs +++ b/src/librustdoc/html/render/context.rs @@ -3,7 +3,7 @@ use std::collections::BTreeMap; use std::io; use std::path::{Path, PathBuf}; use std::rc::Rc; -use std::sync::mpsc::{channel, Receiver}; +use std::sync::mpsc::{Receiver, channel}; use rinja::Template; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; @@ -11,24 +11,24 @@ use rustc_hir::def_id::{DefIdMap, LOCAL_CRATE}; use rustc_middle::ty::TyCtxt; use rustc_session::Session; use rustc_span::edition::Edition; -use rustc_span::{sym, FileName, Symbol}; +use rustc_span::{FileName, Symbol, sym}; use tracing::info; use super::print_item::{full_path, item_path, print_item}; -use super::sidebar::{print_sidebar, sidebar_module_like, ModuleLike, Sidebar}; -use super::{collect_spans_and_sources, scrape_examples_help, AllTypes, LinkFromSrc, StylePath}; +use super::sidebar::{ModuleLike, Sidebar, print_sidebar, sidebar_module_like}; +use super::{AllTypes, LinkFromSrc, StylePath, collect_spans_and_sources, scrape_examples_help}; use crate::clean::types::ExternalLocation; use crate::clean::utils::has_doc_flag; use crate::clean::{self, ExternalCrate}; use crate::config::{ModuleSorting, RenderOptions, ShouldMerge}; use crate::docfs::{DocFS, PathError}; use crate::error::Error; +use crate::formats::FormatRenderer; use crate::formats::cache::Cache; use crate::formats::item_type::ItemType; -use crate::formats::FormatRenderer; use crate::html::escape::Escape; -use crate::html::format::{join_with_double_colon, Buffer}; -use crate::html::markdown::{self, plain_text_summary, ErrorCodes, IdMap}; +use crate::html::format::{Buffer, join_with_double_colon}; +use crate::html::markdown::{self, ErrorCodes, IdMap, plain_text_summary}; use crate::html::render::write_shared::write_shared; use crate::html::url_parts_builder::UrlPartsBuilder; use crate::html::{layout, sources, static_files}; diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 668bd391348..227df0c5f39 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -48,30 +48,30 @@ use rinja::Template; use rustc_attr::{ConstStability, DeprecatedSince, Deprecation, StabilityLevel, StableSince}; use rustc_data_structures::captures::Captures; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use rustc_hir::def_id::{DefId, DefIdSet}; use rustc_hir::Mutability; +use rustc_hir::def_id::{DefId, DefIdSet}; use rustc_middle::ty::print::PrintTraitRefExt; use rustc_middle::ty::{self, TyCtxt}; use rustc_session::RustcVersion; -use rustc_span::symbol::{sym, Symbol}; -use rustc_span::{BytePos, FileName, RealFileName, DUMMY_SP}; +use rustc_span::symbol::{Symbol, sym}; +use rustc_span::{BytePos, DUMMY_SP, FileName, RealFileName}; use serde::ser::SerializeMap; use serde::{Serialize, Serializer}; use tracing::{debug, info}; pub(crate) use self::context::*; -pub(crate) use self::span_map::{collect_spans_and_sources, LinkFromSrc}; +pub(crate) use self::span_map::{LinkFromSrc, collect_spans_and_sources}; pub(crate) use self::write_shared::*; use crate::clean::{self, ItemId, RenderedLink}; use crate::error::Error; +use crate::formats::Impl; use crate::formats::cache::Cache; use crate::formats::item_type::ItemType; -use crate::formats::Impl; use crate::html::escape::Escape; use crate::html::format::{ - display_fn, href, join_with_double_colon, print_abi_with_space, print_constness_with_space, - print_default_space, print_generic_bounds, print_where_clause, visibility_print_with_space, - Buffer, Ending, HrefError, PrintWithSpace, + Buffer, Ending, HrefError, PrintWithSpace, display_fn, href, join_with_double_colon, + print_abi_with_space, print_constness_with_space, print_default_space, print_generic_bounds, + print_where_clause, visibility_print_with_space, }; use crate::html::markdown::{ HeadingOffset, IdMap, Markdown, MarkdownItemInfo, MarkdownSummaryLine, @@ -79,7 +79,7 @@ use crate::html::markdown::{ use crate::html::static_files::SCRAPE_EXAMPLES_HELP_MD; use crate::html::{highlight, sources}; use crate::scrape_examples::{CallData, CallLocation}; -use crate::{try_none, DOC_RUST_LANG_ORG_CHANNEL}; +use crate::{DOC_RUST_LANG_ORG_CHANNEL, try_none}; 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 52e25152770..d120e7f36eb 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -13,27 +13,27 @@ use rustc_hir::def_id::DefId; use rustc_index::IndexVec; use rustc_middle::ty::{self, TyCtxt}; use rustc_span::hygiene::MacroKind; -use rustc_span::symbol::{kw, sym, Symbol}; +use rustc_span::symbol::{Symbol, kw, sym}; use rustc_target::abi::VariantIdx; use tracing::{debug, info}; use super::type_layout::document_type_layout; use super::{ + AssocItemLink, AssocItemRender, Context, ImplRenderingParameters, RenderMode, collect_paths_for_type, document, ensure_trailing_slash, get_filtered_impls_for_reference, item_ty_to_section, notable_traits_button, notable_traits_json, render_all_impls, render_assoc_item, render_assoc_items, render_attributes_in_code, render_attributes_in_pre, render_impl, render_rightside, render_stability_since_raw, - render_stability_since_raw_with_extra, write_section_heading, AssocItemLink, AssocItemRender, - Context, ImplRenderingParameters, RenderMode, + render_stability_since_raw_with_extra, write_section_heading, }; use crate::clean; use crate::config::ModuleSorting; -use crate::formats::item_type::ItemType; use crate::formats::Impl; +use crate::formats::item_type::ItemType; use crate::html::escape::{Escape, EscapeBodyTextWithWbr}; use crate::html::format::{ - display_fn, join_with_double_colon, print_abi_with_space, print_constness_with_space, - print_where_clause, visibility_print_with_space, Buffer, Ending, PrintWithSpace, + Buffer, Ending, PrintWithSpace, display_fn, join_with_double_colon, print_abi_with_space, + print_constness_with_space, print_where_clause, visibility_print_with_space, }; use crate::html::highlight; use crate::html::markdown::{HeadingOffset, MarkdownSummaryLine}; diff --git a/src/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs index 86b719c46e8..660ca3b2594 100644 --- a/src/librustdoc/html/render/search_index.rs +++ b/src/librustdoc/html/render/search_index.rs @@ -8,7 +8,7 @@ use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; use rustc_middle::ty::TyCtxt; use rustc_span::def_id::DefId; use rustc_span::sym; -use rustc_span::symbol::{kw, Symbol}; +use rustc_span::symbol::{Symbol, kw}; use serde::ser::{Serialize, SerializeSeq, SerializeStruct, Serializer}; use thin_vec::ThinVec; use tracing::instrument; @@ -1169,14 +1169,13 @@ fn simplify_fn_type<'a, 'tcx>( *stored_bounds = type_bounds; } } - ty_constraints.push(( - RenderTypeId::AssociatedType(name), - vec![RenderType { + ty_constraints.push((RenderTypeId::AssociatedType(name), vec![ + RenderType { id: Some(RenderTypeId::Index(idx)), generics: None, bindings: None, - }], - )) + }, + ])) } } } diff --git a/src/librustdoc/html/render/sidebar.rs b/src/librustdoc/html/render/sidebar.rs index 842ee81624e..e7706e7fdea 100644 --- a/src/librustdoc/html/render/sidebar.rs +++ b/src/librustdoc/html/render/sidebar.rs @@ -8,10 +8,10 @@ use rustc_hir::def_id::DefIdSet; use rustc_middle::ty::{self, TyCtxt}; use tracing::debug; -use super::{item_ty_to_section, Context, ItemSection}; +use super::{Context, ItemSection, item_ty_to_section}; use crate::clean; -use crate::formats::item_type::ItemType; use crate::formats::Impl; +use crate::formats::item_type::ItemType; use crate::html::format::Buffer; use crate::html::markdown::{IdMap, MarkdownWithToc}; diff --git a/src/librustdoc/html/render/span_map.rs b/src/librustdoc/html/render/span_map.rs index 5b53277c059..2143f1ff236 100644 --- a/src/librustdoc/html/render/span_map.rs +++ b/src/librustdoc/html/render/span_map.rs @@ -10,7 +10,7 @@ use rustc_middle::ty::TyCtxt; use rustc_span::hygiene::MacroKind; use rustc_span::{BytePos, ExpnKind, Span}; -use crate::clean::{self, rustc_span, PrimitiveType}; +use crate::clean::{self, PrimitiveType, rustc_span}; use crate::html::sources; /// This enum allows us to store two different kinds of information: diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index dc1a8cca6bc..16253799215 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -29,26 +29,26 @@ use itertools::Itertools; use regex::Regex; use rustc_data_structures::flock; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use rustc_middle::ty::fast_reject::DeepRejectCtxt; use rustc_middle::ty::TyCtxt; -use rustc_span::def_id::DefId; +use rustc_middle::ty::fast_reject::DeepRejectCtxt; use rustc_span::Symbol; +use rustc_span::def_id::DefId; use serde::de::DeserializeOwned; use serde::ser::SerializeSeq; use serde::{Deserialize, Serialize, Serializer}; -use super::{collect_paths_for_type, ensure_trailing_slash, Context, RenderMode}; +use super::{Context, RenderMode, collect_paths_for_type, ensure_trailing_slash}; use crate::clean::{Crate, Item, ItemId, ItemKind}; use crate::config::{EmitType, PathToParts, RenderOptions, ShouldMerge}; use crate::docfs::PathError; use crate::error::Error; +use crate::formats::Impl; use crate::formats::cache::Cache; use crate::formats::item_type::ItemType; -use crate::formats::Impl; use crate::html::format::Buffer; use crate::html::layout; use crate::html::render::ordered_json::{EscapedJson, OrderedJson}; -use crate::html::render::search_index::{build_index, SerializedSearchIndex}; +use crate::html::render::search_index::{SerializedSearchIndex, build_index}; use crate::html::render::sorted_template::{self, FileFormat, SortedTemplate}; use crate::html::render::{AssocItemLink, ImplRenderingParameters, StylePath}; use crate::html::static_files::{self, suffix_path}; diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs index 0d6a4603cd2..c8c45b8fa32 100644 --- a/src/librustdoc/html/sources.rs +++ b/src/librustdoc/html/sources.rs @@ -10,7 +10,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir::def_id::LOCAL_CRATE; use rustc_middle::ty::TyCtxt; use rustc_session::Session; -use rustc_span::{sym, FileName}; +use rustc_span::{FileName, sym}; use tracing::info; use crate::clean; diff --git a/src/librustdoc/html/tests.rs b/src/librustdoc/html/tests.rs index 059f99c0c9e..b568942bbcb 100644 --- a/src/librustdoc/html/tests.rs +++ b/src/librustdoc/html/tests.rs @@ -1,4 +1,4 @@ -use rustc_span::{sym, Symbol}; +use rustc_span::{Symbol, sym}; use crate::html::format::href_relative_parts; |
