diff options
| author | Hirokazu Hata <h.hata.ai.t@gmail.com> | 2019-02-23 16:40:07 +0900 |
|---|---|---|
| committer | Hirokazu Hata <h.hata.ai.t@gmail.com> | 2019-02-23 16:40:07 +0900 |
| commit | 1932d7a52d8cdfdadbf165f2340de45e9e9ef9e2 (patch) | |
| tree | ddb5d481975e0b49148e76faa7738f9c591d0228 /src/librustdoc/html | |
| parent | 082c86175fcf72c355e6a889956fbea59e65bcdb (diff) | |
| download | rust-1932d7a52d8cdfdadbf165f2340de45e9e9ef9e2.tar.gz rust-1932d7a52d8cdfdadbf165f2340de45e9e9ef9e2.zip | |
Transition librustdoc to 2018 edition
Diffstat (limited to 'src/librustdoc/html')
| -rw-r--r-- | src/librustdoc/html/escape.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/format.rs | 79 | ||||
| -rw-r--r-- | src/librustdoc/html/highlight.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/html/item_type.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/html/layout.rs | 7 | ||||
| -rw-r--r-- | src/librustdoc/html/markdown.rs | 26 | ||||
| -rw-r--r-- | src/librustdoc/html/render.rs | 168 | ||||
| -rw-r--r-- | src/librustdoc/html/toc.rs | 4 |
8 files changed, 147 insertions, 147 deletions
diff --git a/src/librustdoc/html/escape.rs b/src/librustdoc/html/escape.rs index 35858d84150..182a2dd2e9c 100644 --- a/src/librustdoc/html/escape.rs +++ b/src/librustdoc/html/escape.rs @@ -10,7 +10,7 @@ use std::fmt; pub struct Escape<'a>(pub &'a str); impl<'a> fmt::Display for Escape<'a> { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { // Because the internet is always right, turns out there's not that many // characters to escape: http://stackoverflow.com/questions/7381974 let Escape(s) = *self; diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index df7835214eb..4463dad1c8a 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -12,10 +12,11 @@ use rustc::hir::def_id::DefId; use rustc_target::spec::abi::Abi; use rustc::hir; -use clean::{self, PrimitiveType}; -use core::DocAccessLevels; -use html::item_type::ItemType; -use html::render::{self, cache, CURRENT_LOCATION_KEY}; +use crate::clean::{self, PrimitiveType}; +use crate::core::DocAccessLevels; +use crate::html::item_type::ItemType; +use crate::html::render::{self, cache, CURRENT_LOCATION_KEY}; + /// Helper to render an optional visibility with a space after it (if the /// visibility is preset) @@ -42,7 +43,7 @@ pub struct RawMutableSpace(pub clean::Mutability); /// Wrapper struct for emitting type parameter bounds. pub struct GenericBounds<'a>(pub &'a [clean::GenericBound]); /// Wrapper struct for emitting a comma-separated list of items -pub struct CommaSep<'a, T: 'a>(pub &'a [T]); +pub struct CommaSep<'a, T>(pub &'a [T]); pub struct AbiSpace(pub Abi); /// Wrapper struct for properly emitting a function or method declaration. @@ -94,7 +95,7 @@ impl ConstnessSpace { } impl<'a, T: fmt::Display> fmt::Display for CommaSep<'a, T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { for (i, item) in self.0.iter().enumerate() { if i != 0 { write!(f, ", ")?; } fmt::Display::fmt(item, f)?; @@ -104,7 +105,7 @@ impl<'a, T: fmt::Display> fmt::Display for CommaSep<'a, T> { } impl<'a> fmt::Display for GenericBounds<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let &GenericBounds(bounds) = self; for (i, bound) in bounds.iter().enumerate() { if i > 0 { @@ -117,7 +118,7 @@ impl<'a> fmt::Display for GenericBounds<'a> { } impl fmt::Display for clean::GenericParamDef { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self.kind { clean::GenericParamDefKind::Lifetime => write!(f, "{}", self.name), clean::GenericParamDefKind::Type { ref bounds, ref default, .. } => { @@ -156,7 +157,7 @@ impl fmt::Display for clean::GenericParamDef { } impl fmt::Display for clean::Generics { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let real_params = self.params .iter() .filter(|p| !p.is_synthetic_type_param()) @@ -173,7 +174,7 @@ impl fmt::Display for clean::Generics { } impl<'a> fmt::Display for WhereClause<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let &WhereClause { gens, indent, end_newline } = self; if gens.where_predicates.is_empty() { return Ok(()); @@ -252,14 +253,14 @@ impl<'a> fmt::Display for WhereClause<'a> { } impl fmt::Display for clean::Lifetime { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.get_ref())?; Ok(()) } } impl fmt::Display for clean::PolyTrait { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if !self.generic_params.is_empty() { if f.alternate() { write!(f, "for<{:#}> ", CommaSep(&self.generic_params))?; @@ -276,7 +277,7 @@ impl fmt::Display for clean::PolyTrait { } impl fmt::Display for clean::GenericBound { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { clean::GenericBound::Outlives(ref lt) => { write!(f, "{}", *lt) @@ -297,7 +298,7 @@ impl fmt::Display for clean::GenericBound { } impl fmt::Display for clean::GenericArgs { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { clean::GenericArgs::AngleBracketed { ref lifetimes, ref types, ref bindings @@ -374,7 +375,7 @@ impl fmt::Display for clean::GenericArgs { } impl fmt::Display for clean::PathSegment { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(&self.name)?; if f.alternate() { write!(f, "{:#}", self.args) @@ -385,7 +386,7 @@ impl fmt::Display for clean::PathSegment { } impl fmt::Display for clean::Path { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if self.global { f.write_str("::")? } @@ -445,7 +446,7 @@ pub fn href(did: DefId) -> Option<(String, ItemType, Vec<String>)> { /// Used when rendering a `ResolvedPath` structure. This invokes the `path` /// rendering function with the necessary arguments for linking to a local path. -fn resolved_path(w: &mut fmt::Formatter, did: DefId, path: &clean::Path, +fn resolved_path(w: &mut fmt::Formatter<'_>, did: DefId, path: &clean::Path, print_all: bool, use_absolute: bool) -> fmt::Result { let last = path.segments.last().unwrap(); @@ -474,7 +475,7 @@ fn resolved_path(w: &mut fmt::Formatter, did: DefId, path: &clean::Path, Ok(()) } -fn primitive_link(f: &mut fmt::Formatter, +fn primitive_link(f: &mut fmt::Formatter<'_>, prim: clean::PrimitiveType, name: &str) -> fmt::Result { let m = cache(); @@ -519,7 +520,7 @@ fn primitive_link(f: &mut fmt::Formatter, } /// Helper to render type parameters -fn tybounds(w: &mut fmt::Formatter, +fn tybounds(w: &mut fmt::Formatter<'_>, typarams: &Option<Vec<clean::GenericBound>>) -> fmt::Result { match *typarams { Some(ref params) => { @@ -540,7 +541,7 @@ impl<'a> HRef<'a> { } impl<'a> fmt::Display for HRef<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match href(self.did) { Some((url, shortty, fqp)) => if !f.alternate() { write!(f, "<a class=\"{}\" href=\"{}\" title=\"{} {}\">{}</a>", @@ -553,7 +554,7 @@ impl<'a> fmt::Display for HRef<'a> { } } -fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter, use_absolute: bool) -> fmt::Result { +fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter<'_>, use_absolute: bool) -> fmt::Result { match *t { clean::Generic(ref name) => { f.write_str(name) @@ -745,13 +746,13 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter, use_absolute: bool) -> fmt: } impl fmt::Display for clean::Type { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt_type(self, f, false) } } fn fmt_impl(i: &clean::Impl, - f: &mut fmt::Formatter, + f: &mut fmt::Formatter<'_>, link_trait: bool, use_absolute: bool) -> fmt::Result { if f.alternate() { @@ -791,20 +792,20 @@ fn fmt_impl(i: &clean::Impl, } impl fmt::Display for clean::Impl { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt_impl(self, f, true, false) } } // The difference from above is that trait is not hyperlinked. pub fn fmt_impl_for_trait_page(i: &clean::Impl, - f: &mut fmt::Formatter, + f: &mut fmt::Formatter<'_>, use_absolute: bool) -> fmt::Result { fmt_impl(i, f, false, use_absolute) } impl fmt::Display for clean::Arguments { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { for (i, input) in self.values.iter().enumerate() { if !input.name.is_empty() { write!(f, "{}: ", input.name)?; @@ -821,7 +822,7 @@ impl fmt::Display for clean::Arguments { } impl fmt::Display for clean::FunctionRetTy { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { clean::Return(clean::Tuple(ref tys)) if tys.is_empty() => Ok(()), clean::Return(ref ty) if f.alternate() => write!(f, " -> {:#}", ty), @@ -832,7 +833,7 @@ impl fmt::Display for clean::FunctionRetTy { } impl fmt::Display for clean::FnDecl { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if self.variadic { if f.alternate() { write!(f, "({args:#}, ...){arrow:#}", args = self.inputs, arrow = self.output) @@ -850,7 +851,7 @@ impl fmt::Display for clean::FnDecl { } impl<'a> fmt::Display for Function<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let &Function { decl, header_len, indent, asyncness } = self; let amp = if f.alternate() { "&" } else { "&" }; let mut args = String::new(); @@ -947,7 +948,7 @@ impl<'a> fmt::Display for Function<'a> { } impl<'a> fmt::Display for VisSpace<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self.get() { Some(clean::Public) => f.write_str("pub "), Some(clean::Inherited) | None => Ok(()), @@ -967,7 +968,7 @@ impl<'a> fmt::Display for VisSpace<'a> { } impl fmt::Display for UnsafetySpace { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self.get() { hir::Unsafety::Unsafe => write!(f, "unsafe "), hir::Unsafety::Normal => Ok(()) @@ -976,7 +977,7 @@ impl fmt::Display for UnsafetySpace { } impl fmt::Display for ConstnessSpace { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self.get() { hir::Constness::Const => write!(f, "const "), hir::Constness::NotConst => Ok(()) @@ -985,7 +986,7 @@ impl fmt::Display for ConstnessSpace { } impl fmt::Display for AsyncSpace { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self.0 { hir::IsAsync::Async => write!(f, "async "), hir::IsAsync::NotAsync => Ok(()), @@ -994,7 +995,7 @@ impl fmt::Display for AsyncSpace { } impl fmt::Display for clean::Import { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { clean::Import::Simple(ref name, ref src) => { if *name == src.path.last_name() { @@ -1015,7 +1016,7 @@ impl fmt::Display for clean::Import { } impl fmt::Display for clean::ImportSource { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self.did { Some(did) => resolved_path(f, did, &self.path, true, false), _ => { @@ -1032,7 +1033,7 @@ impl fmt::Display for clean::ImportSource { } impl fmt::Display for clean::TypeBinding { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if f.alternate() { write!(f, "{} = {:#}", self.name, self.ty) } else { @@ -1042,7 +1043,7 @@ impl fmt::Display for clean::TypeBinding { } impl fmt::Display for MutableSpace { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { MutableSpace(clean::Immutable) => Ok(()), MutableSpace(clean::Mutable) => write!(f, "mut "), @@ -1051,7 +1052,7 @@ impl fmt::Display for MutableSpace { } impl fmt::Display for RawMutableSpace { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { RawMutableSpace(clean::Immutable) => write!(f, "const "), RawMutableSpace(clean::Mutable) => write!(f, "mut "), @@ -1060,7 +1061,7 @@ impl fmt::Display for RawMutableSpace { } impl fmt::Display for AbiSpace { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let quot = if f.alternate() { "\"" } else { """ }; match self.0 { Abi::Rust => Ok(()), diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 66b1b5b4d75..d66455f91ba 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -5,7 +5,7 @@ //! //! Use the `render_with_highlighting` to highlight some rust code. -use html::escape::Escape; +use crate::html::escape::Escape; use std::fmt::Display; use std::io; diff --git a/src/librustdoc/html/item_type.rs b/src/librustdoc/html/item_type.rs index 8a3b5484f39..353fa4ae8c9 100644 --- a/src/librustdoc/html/item_type.rs +++ b/src/librustdoc/html/item_type.rs @@ -2,7 +2,7 @@ use std::fmt; use syntax::ext::base::MacroKind; -use clean; +use crate::clean; /// Item type. Corresponds to `clean::ItemEnum` variants. /// @@ -189,7 +189,7 @@ impl ItemType { } impl fmt::Display for ItemType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.css_class().fmt(f) } } @@ -211,7 +211,7 @@ impl NameSpace { } impl fmt::Display for NameSpace { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.to_static_str().fmt(f) } } diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index b444993c1b5..6ff3917a265 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -2,9 +2,8 @@ use std::fmt; use std::io; use std::path::PathBuf; -use externalfiles::ExternalHtml; - -use html::render::SlashChecker; +use crate::externalfiles::ExternalHtml; +use crate::html::render::SlashChecker; #[derive(Clone)] pub struct Layout { @@ -29,7 +28,7 @@ pub struct Page<'a> { pub fn render<T: fmt::Display, S: fmt::Display>( dst: &mut dyn io::Write, layout: &Layout, - page: &Page, + page: &Page<'_>, sidebar: &S, t: &T, css_file_extension: bool, diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 386480313dc..a70fe363ca6 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -29,9 +29,9 @@ use std::ops::Range; use std::str; use syntax::edition::Edition; -use html::toc::TocBuilder; -use html::highlight; -use test; +use crate::html::toc::TocBuilder; +use crate::html::highlight; +use crate::test; use pulldown_cmark::{html, Event, Tag, Parser}; use pulldown_cmark::{Options, OPTION_ENABLE_FOOTNOTES, OPTION_ENABLE_TABLES}; @@ -101,7 +101,7 @@ impl<'a> Line<'a> { // is done in the single # case. This inconsistency seems okay, if non-ideal. In // order to fix it we'd have to iterate to find the first non-# character, and // then reallocate to remove it; which would make us return a String. -fn map_line(s: &str) -> Line { +fn map_line(s: &str) -> Line<'_> { let trimmed = s.trim(); if trimmed.starts_with("##") { Line::Shown(Cow::Owned(s.replacen("##", "#", 1))) @@ -185,7 +185,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'a, I> { } } let lines = origtext.lines().filter_map(|l| map_line(l).for_html()); - let text = lines.collect::<Vec<Cow<str>>>().join("\n"); + let text = lines.collect::<Vec<Cow<'_, str>>>().join("\n"); PLAYGROUND.with(|play| { // insert newline to clearly separate it from the // previous block so we can shorten the html output @@ -196,7 +196,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'a, I> { } let test = origtext.lines() .map(|l| map_line(l).for_code()) - .collect::<Vec<Cow<str>>>().join("\n"); + .collect::<Vec<Cow<'_, str>>>().join("\n"); let krate = krate.as_ref().map(|s| &**s); let (test, _) = test::make_test(&test, krate, false, &Default::default()); @@ -386,7 +386,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> SummaryLine<'a, I> { } } -fn check_if_allowed_tag(t: &Tag) -> bool { +fn check_if_allowed_tag(t: &Tag<'_>) -> bool { match *t { Tag::Paragraph | Tag::Item @@ -523,7 +523,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for Footnotes<'a, I> { pub struct TestableCodeError(()); impl fmt::Display for TestableCodeError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "invalid start of a new code block") } } @@ -569,7 +569,7 @@ pub fn find_testable_code<T: test::Tester>( } if let Some(offset) = offset { let lines = test_s.lines().map(|l| map_line(l).for_code()); - let text = lines.collect::<Vec<Cow<str>>>().join("\n"); + let text = lines.collect::<Vec<Cow<'_, str>>>().join("\n"); nb_lines += doc[prev_offset..offset].lines().count(); let line = tests.get_line() + (nb_lines - 1); tests.add_test(text, block_info, line); @@ -681,7 +681,7 @@ impl LangString { } impl<'a> fmt::Display for Markdown<'a> { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { let Markdown(md, links, ref ids, codes) = *self; let mut ids = ids.borrow_mut(); @@ -714,7 +714,7 @@ impl<'a> fmt::Display for Markdown<'a> { } impl<'a> fmt::Display for MarkdownWithToc<'a> { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { let MarkdownWithToc(md, ref ids, codes) = *self; let mut ids = ids.borrow_mut(); @@ -742,7 +742,7 @@ impl<'a> fmt::Display for MarkdownWithToc<'a> { } impl<'a> fmt::Display for MarkdownHtml<'a> { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { let MarkdownHtml(md, ref ids, codes) = *self; let mut ids = ids.borrow_mut(); @@ -772,7 +772,7 @@ impl<'a> fmt::Display for MarkdownHtml<'a> { } impl<'a> fmt::Display for MarkdownSummaryLine<'a> { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { let MarkdownSummaryLine(md, links) = *self; // This is actually common enough to special-case if md.is_empty() { return Ok(()) } diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index d037154272d..6bbc0bc49d3 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -55,18 +55,18 @@ use rustc::hir; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc_data_structures::flock; -use clean::{self, AttributesExt, Deprecation, GetDefId, SelfTy, Mutability}; -use config::RenderOptions; -use doctree; -use fold::DocFolder; -use html::escape::Escape; -use html::format::{AsyncSpace, ConstnessSpace}; -use html::format::{GenericBounds, WhereClause, href, AbiSpace}; -use html::format::{VisSpace, Function, UnsafetySpace, MutableSpace}; -use html::format::fmt_impl_for_trait_page; -use html::item_type::ItemType; -use html::markdown::{self, Markdown, MarkdownHtml, MarkdownSummaryLine, ErrorCodes, IdMap}; -use html::{highlight, layout, static_files}; +use crate::clean::{self, AttributesExt, Deprecation, GetDefId, SelfTy, Mutability}; +use crate::config::RenderOptions; +use crate::doctree; +use crate::fold::DocFolder; +use crate::html::escape::Escape; +use crate::html::format::{AsyncSpace, ConstnessSpace}; +use crate::html::format::{GenericBounds, WhereClause, href, AbiSpace}; +use crate::html::format::{VisSpace, Function, UnsafetySpace, MutableSpace}; +use crate::html::format::fmt_impl_for_trait_page; +use crate::html::item_type::ItemType; +use crate::html::markdown::{self, Markdown, MarkdownHtml, MarkdownSummaryLine, ErrorCodes, IdMap}; +use crate::html::{highlight, layout, static_files}; use minifier; @@ -76,7 +76,7 @@ pub type NameDoc = (String, Option<String>); pub struct SlashChecker<'a>(pub &'a str); impl<'a> Display for SlashChecker<'a> { - fn fmt(&self, f: &mut Formatter) -> fmt::Result { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { if !self.0.ends_with("/") && !self.0.is_empty() { write!(f, "{}/", self.0) } else { @@ -223,7 +223,7 @@ impl error::Error for Error { } impl Display for Error { - fn fmt(&self, f: &mut Formatter) -> fmt::Result { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "\"{}\": {}", self.file.display(), self.error) } } @@ -367,7 +367,7 @@ pub struct Cache { #[derive(Default)] pub struct RenderInfo { pub inlined: FxHashSet<DefId>, - pub external_paths: ::core::ExternalPaths, + pub external_paths: crate::core::ExternalPaths, pub external_typarams: FxHashMap<DefId, String>, pub exact_paths: FxHashMap<DefId, Vec<String>>, pub access_levels: AccessLevels<DefId>, @@ -1130,7 +1130,7 @@ themePicker.onblur = handleThemeButtonsBlur; md_opts.output = cx.dst.clone(); md_opts.external_html = (*cx.shared).layout.external_html.clone(); - ::markdown::render(index_page, md_opts, diag); + crate::markdown::render(index_page, md_opts, diag); } else { let dst = cx.dst.join("index.html"); let mut w = BufWriter::new(try_err!(File::create(&dst), &dst)); @@ -1808,7 +1808,7 @@ impl ItemEntry { } impl fmt::Display for ItemEntry { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "<a href='{}'>{}</a>", self.url, Escape(&self.name)) } } @@ -1893,7 +1893,7 @@ impl AllTypes { } } -fn print_entries(f: &mut fmt::Formatter, e: &FxHashSet<ItemEntry>, title: &str, +fn print_entries(f: &mut fmt::Formatter<'_>, e: &FxHashSet<ItemEntry>, title: &str, class: &str) -> fmt::Result { if !e.is_empty() { let mut e: Vec<&ItemEntry> = e.iter().collect(); @@ -1908,7 +1908,7 @@ fn print_entries(f: &mut fmt::Formatter, e: &FxHashSet<ItemEntry>, title: &str, } impl fmt::Display for AllTypes { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "<h1 class='fqn'>\ <span class='out-of-band'>\ @@ -1965,7 +1965,7 @@ impl<'a> Settings<'a> { } impl<'a> fmt::Display for Settings<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "<h1 class='fqn'>\ <span class='in-band'>Rustdoc settings</span>\ @@ -2364,16 +2364,16 @@ impl<'a> Item<'a> { } } -fn wrap_into_docblock<F>(w: &mut fmt::Formatter, +fn wrap_into_docblock<F>(w: &mut fmt::Formatter<'_>, f: F) -> fmt::Result -where F: Fn(&mut fmt::Formatter) -> fmt::Result { +where F: Fn(&mut fmt::Formatter<'_>) -> fmt::Result { write!(w, "<div class=\"docblock type-decl hidden-by-usual-hider\">")?; f(w)?; write!(w, "</div>") } impl<'a> fmt::Display for Item<'a> { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { debug_assert!(!self.item.is_stripped()); // Write the breadcrumb trail header for the top write!(fmt, "<h1 class='fqn'><span class='out-of-band'>")?; @@ -2516,7 +2516,7 @@ fn plain_summary_line_short(s: Option<&str>) -> String { markdown::plain_summary_line_full(&line[..], true) } -fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Result { +fn document(w: &mut fmt::Formatter<'_>, cx: &Context, item: &clean::Item) -> fmt::Result { if let Some(ref name) = item.name { info!("Documenting {}", name); } @@ -2526,7 +2526,7 @@ fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Re } /// Render md_text as markdown. -fn render_markdown(w: &mut fmt::Formatter, +fn render_markdown(w: &mut fmt::Formatter<'_>, cx: &Context, md_text: &str, links: Vec<(String, String)>, @@ -2541,7 +2541,7 @@ fn render_markdown(w: &mut fmt::Formatter, cx.codes)) } -fn document_short(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item, link: AssocItemLink, +fn document_short(w: &mut fmt::Formatter<'_>, cx: &Context, item: &clean::Item, link: AssocItemLink<'_>, prefix: &str, is_hidden: bool) -> fmt::Result { if let Some(s) = item.doc_value() { let markdown = if s.contains('\n') { @@ -2559,7 +2559,7 @@ fn document_short(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item, link Ok(()) } -fn document_full(w: &mut fmt::Formatter, item: &clean::Item, +fn document_full(w: &mut fmt::Formatter<'_>, item: &clean::Item, cx: &Context, prefix: &str, is_hidden: bool) -> fmt::Result { if let Some(s) = cx.shared.maybe_collapsed_doc_value(item) { debug!("Doc block: =====\n{}\n=====", s); @@ -2572,7 +2572,7 @@ fn document_full(w: &mut fmt::Formatter, item: &clean::Item, Ok(()) } -fn document_stability(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item, +fn document_stability(w: &mut fmt::Formatter<'_>, cx: &Context, item: &clean::Item, is_hidden: bool) -> fmt::Result { let stabilities = short_stability(item, cx); if !stabilities.is_empty() { @@ -2589,7 +2589,7 @@ fn document_non_exhaustive_header(item: &clean::Item) -> &str { if item.is_non_exhaustive() { " (Non-exhaustive)" } else { "" } } -fn document_non_exhaustive(w: &mut fmt::Formatter, item: &clean::Item) -> fmt::Result { +fn document_non_exhaustive(w: &mut fmt::Formatter<'_>, item: &clean::Item) -> fmt::Result { if item.is_non_exhaustive() { write!(w, "<div class='docblock non-exhaustive non-exhaustive-{}'>", { if item.is_struct() { "struct" } else if item.is_enum() { "enum" } else { "type" } @@ -2637,7 +2637,7 @@ fn name_key(name: &str) -> (&str, u64, usize) { } } -fn item_module(w: &mut fmt::Formatter, cx: &Context, +fn item_module(w: &mut fmt::Formatter<'_>, cx: &Context, item: &clean::Item, items: &[clean::Item]) -> fmt::Result { document(w, cx, item)?; @@ -2741,7 +2741,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context, match myitem.inner { clean::ExternCrateItem(ref name, ref src) => { - use html::format::HRef; + use crate::html::format::HRef; match *src { Some(ref src) => { @@ -2957,7 +2957,7 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> { stability } -fn item_constant(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, +fn item_constant(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item, c: &clean::Constant) -> fmt::Result { write!(w, "<pre class='rust const'>")?; render_attributes(w, it)?; @@ -2969,7 +2969,7 @@ fn item_constant(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, document(w, cx, it) } -fn item_static(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, +fn item_static(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item, s: &clean::Static) -> fmt::Result { write!(w, "<pre class='rust static'>")?; render_attributes(w, it)?; @@ -2982,7 +2982,7 @@ fn item_static(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, document(w, cx, it) } -fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, +fn item_function(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item, f: &clean::Function) -> fmt::Result { let header_len = format!( "{}{}{}{}{:#}fn {}{:#}", @@ -3016,7 +3016,7 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, document(w, cx, it) } -fn render_implementor(cx: &Context, implementor: &Impl, w: &mut fmt::Formatter, +fn render_implementor(cx: &Context, implementor: &Impl, w: &mut fmt::Formatter<'_>, implementor_dups: &FxHashMap<&str, (DefId, bool)>) -> fmt::Result { // If there's already another implementor that has the same abbridged name, use the // full path, for example in `std::iter::ExactSizeIterator` @@ -3033,7 +3033,7 @@ fn render_implementor(cx: &Context, implementor: &Impl, w: &mut fmt::Formatter, Ok(()) } -fn render_impls(cx: &Context, w: &mut fmt::Formatter, +fn render_impls(cx: &Context, w: &mut fmt::Formatter<'_>, traits: &[&&Impl], containing_item: &clean::Item) -> fmt::Result { for i in traits { @@ -3070,7 +3070,7 @@ fn compare_impl<'a, 'b>(lhs: &'a &&Impl, rhs: &'b &&Impl) -> Ordering { } fn item_trait( - w: &mut fmt::Formatter, + w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item, t: &clean::Trait, @@ -3156,7 +3156,7 @@ fn item_trait( document(w, cx, it)?; fn write_small_section_header( - w: &mut fmt::Formatter, + w: &mut fmt::Formatter<'_>, id: &str, title: &str, extra_content: &str, @@ -3167,11 +3167,11 @@ fn item_trait( </h2>{2}", id, title, extra_content) } - fn write_loading_content(w: &mut fmt::Formatter, extra_content: &str) -> fmt::Result { + fn write_loading_content(w: &mut fmt::Formatter<'_>, extra_content: &str) -> fmt::Result { write!(w, "{}<span class='loading-content'>Loading content...</span>", extra_content) } - fn trait_item(w: &mut fmt::Formatter, cx: &Context, m: &clean::Item, t: &clean::Item) + fn trait_item(w: &mut fmt::Formatter<'_>, cx: &Context, m: &clean::Item, t: &clean::Item) -> fmt::Result { let name = m.name.as_ref().unwrap(); let item_type = m.type_(); @@ -3328,8 +3328,8 @@ fn item_trait( Ok(()) } -fn naive_assoc_href(it: &clean::Item, link: AssocItemLink) -> String { - use html::item_type::ItemType::*; +fn naive_assoc_href(it: &clean::Item, link: AssocItemLink<'_>) -> String { + use crate::html::item_type::ItemType::*; let name = it.name.as_ref().unwrap(); let ty = match it.type_() { @@ -3347,11 +3347,11 @@ fn naive_assoc_href(it: &clean::Item, link: AssocItemLink) -> String { } } -fn assoc_const(w: &mut fmt::Formatter, +fn assoc_const(w: &mut fmt::Formatter<'_>, it: &clean::Item, ty: &clean::Type, _default: Option<&String>, - link: AssocItemLink) -> fmt::Result { + link: AssocItemLink<'_>) -> fmt::Result { write!(w, "{}const <a href='{}' class=\"constant\"><b>{}</b></a>: {}", VisSpace(&it.visibility), naive_assoc_href(it, link), @@ -3363,7 +3363,7 @@ fn assoc_const(w: &mut fmt::Formatter, fn assoc_type<W: fmt::Write>(w: &mut W, it: &clean::Item, bounds: &[clean::GenericBound], default: Option<&clean::Type>, - link: AssocItemLink) -> fmt::Result { + link: AssocItemLink<'_>) -> fmt::Result { write!(w, "type <a href='{}' class=\"type\">{}</a>", naive_assoc_href(it, link), it.name.as_ref().unwrap())?; @@ -3389,22 +3389,22 @@ fn render_stability_since_raw<'a, T: fmt::Write>( Ok(()) } -fn render_stability_since(w: &mut fmt::Formatter, +fn render_stability_since(w: &mut fmt::Formatter<'_>, item: &clean::Item, containing_item: &clean::Item) -> fmt::Result { render_stability_since_raw(w, item.stable_since(), containing_item.stable_since()) } -fn render_assoc_item(w: &mut fmt::Formatter, +fn render_assoc_item(w: &mut fmt::Formatter<'_>, item: &clean::Item, - link: AssocItemLink, + link: AssocItemLink<'_>, parent: ItemType) -> fmt::Result { - fn method(w: &mut fmt::Formatter, + fn method(w: &mut fmt::Formatter<'_>, meth: &clean::Item, header: hir::FnHeader, g: &clean::Generics, d: &clean::FnDecl, - link: AssocItemLink, + link: AssocItemLink<'_>, parent: ItemType) -> fmt::Result { let name = meth.name.as_ref().unwrap(); @@ -3481,7 +3481,7 @@ fn render_assoc_item(w: &mut fmt::Formatter, } } -fn item_struct(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, +fn item_struct(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item, s: &clean::Struct) -> fmt::Result { wrap_into_docblock(w, |w| { write!(w, "<pre class='rust struct'>")?; @@ -3532,7 +3532,7 @@ fn item_struct(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, render_assoc_items(w, cx, it, it.def_id, AssocItemRender::All) } -fn item_union(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, +fn item_union(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item, s: &clean::Union) -> fmt::Result { wrap_into_docblock(w, |w| { write!(w, "<pre class='rust union'>")?; @@ -3577,7 +3577,7 @@ fn item_union(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, render_assoc_items(w, cx, it, it.def_id, AssocItemRender::All) } -fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, +fn item_enum(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item, e: &clean::Enum) -> fmt::Result { wrap_into_docblock(w, |w| { write!(w, "<pre class='rust enum'>")?; @@ -3666,7 +3666,7 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, write!(w, "</code></span>")?; document(w, cx, variant)?; - use clean::{Variant, VariantKind}; + use crate::clean::{Variant, VariantKind}; if let clean::VariantItem(Variant { kind: VariantKind::Struct(ref s) }) = variant.inner { @@ -3678,7 +3678,7 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, write!(w, "<h3>Fields of <b>{name}</b></h3><div>", name = variant.name.as_ref().unwrap())?; for field in &s.fields { - use clean::StructFieldItem; + use crate::clean::StructFieldItem; if let StructFieldItem(ref ty) = field.inner { let id = cx.derive_id(format!("variant.{}.field.{}", variant.name.as_ref().unwrap(), @@ -3741,7 +3741,7 @@ const ATTRIBUTE_WHITELIST: &'static [&'static str] = &[ "non_exhaustive" ]; -fn render_attributes(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result { +fn render_attributes(w: &mut fmt::Formatter<'_>, it: &clean::Item) -> fmt::Result { let mut attrs = String::new(); for attr in &it.attrs.other_attrs { @@ -3759,7 +3759,7 @@ fn render_attributes(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result { Ok(()) } -fn render_struct(w: &mut fmt::Formatter, it: &clean::Item, +fn render_struct(w: &mut fmt::Formatter<'_>, it: &clean::Item, g: Option<&clean::Generics>, ty: doctree::StructType, fields: &[clean::Item], @@ -3835,7 +3835,7 @@ fn render_struct(w: &mut fmt::Formatter, it: &clean::Item, Ok(()) } -fn render_union(w: &mut fmt::Formatter, it: &clean::Item, +fn render_union(w: &mut fmt::Formatter<'_>, it: &clean::Item, g: Option<&clean::Generics>, fields: &[clean::Item], tab: &str, @@ -3893,11 +3893,11 @@ enum RenderMode { ForDeref { mut_: bool }, } -fn render_assoc_items(w: &mut fmt::Formatter, +fn render_assoc_items(w: &mut fmt::Formatter<'_>, cx: &Context, containing_item: &clean::Item, it: DefId, - what: AssocItemRender) -> fmt::Result { + what: AssocItemRender<'_>) -> fmt::Result { let c = cache(); let v = match c.impls.get(&it) { Some(v) => v, @@ -3955,7 +3955,7 @@ fn render_assoc_items(w: &mut fmt::Formatter, struct RendererStruct<'a, 'b, 'c>(&'a Context, Vec<&'b &'b Impl>, &'c clean::Item); impl<'a, 'b, 'c> fmt::Display for RendererStruct<'a, 'b, 'c> { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { render_impls(self.0, fmt, &self.1, self.2) } } @@ -3996,7 +3996,7 @@ fn render_assoc_items(w: &mut fmt::Formatter, Ok(()) } -fn render_deref_methods(w: &mut fmt::Formatter, cx: &Context, impl_: &Impl, +fn render_deref_methods(w: &mut fmt::Formatter<'_>, cx: &Context, impl_: &Impl, container_item: &clean::Item, deref_mut: bool) -> fmt::Result { let deref_type = impl_.inner_impl().trait_.as_ref().unwrap(); let target = impl_.inner_impl().items.iter().filter_map(|item| { @@ -4107,7 +4107,7 @@ fn spotlight_decl(decl: &clean::FnDecl) -> Result<String, fmt::Error> { Ok(out) } -fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLink, +fn render_impl(w: &mut fmt::Formatter<'_>, cx: &Context, i: &Impl, link: AssocItemLink<'_>, render_mode: RenderMode, outer_version: Option<&str>, show_def_docs: bool, use_absolute: Option<bool>) -> fmt::Result { if render_mode == RenderMode::Normal { @@ -4149,8 +4149,8 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi } } - fn doc_impl_item(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item, - link: AssocItemLink, render_mode: RenderMode, + fn doc_impl_item(w: &mut fmt::Formatter<'_>, cx: &Context, item: &clean::Item, + link: AssocItemLink<'_>, render_mode: RenderMode, is_default_item: bool, outer_version: Option<&str>, trait_: Option<&clean::Trait>, show_def_docs: bool) -> fmt::Result { let item_type = item.type_(); @@ -4264,7 +4264,7 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi false, outer_version, trait_, show_def_docs)?; } - fn render_default_items(w: &mut fmt::Formatter, + fn render_default_items(w: &mut fmt::Formatter<'_>, cx: &Context, t: &clean::Trait, i: &clean::Impl, @@ -4297,7 +4297,7 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi } fn item_existential( - w: &mut fmt::Formatter, + w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item, t: &clean::Existential, @@ -4319,7 +4319,7 @@ fn item_existential( render_assoc_items(w, cx, it, it.def_id, AssocItemRender::All) } -fn item_trait_alias(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, +fn item_trait_alias(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item, t: &clean::TraitAlias) -> fmt::Result { write!(w, "<pre class='rust trait-alias'>")?; render_attributes(w, it)?; @@ -4338,7 +4338,7 @@ fn item_trait_alias(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, render_assoc_items(w, cx, it, it.def_id, AssocItemRender::All) } -fn item_typedef(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, +fn item_typedef(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item, t: &clean::Typedef) -> fmt::Result { write!(w, "<pre class='rust typedef'>")?; render_attributes(w, it)?; @@ -4357,7 +4357,7 @@ fn item_typedef(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, render_assoc_items(w, cx, it, it.def_id, AssocItemRender::All) } -fn item_foreign_type(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item) -> fmt::Result { +fn item_foreign_type(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item) -> fmt::Result { writeln!(w, "<pre class='rust foreigntype'>extern {{")?; render_attributes(w, it)?; write!( @@ -4373,7 +4373,7 @@ fn item_foreign_type(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item) -> } impl<'a> fmt::Display for Sidebar<'a> { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { let cx = self.cx; let it = self.item; let parentlen = cx.current.len() - if it.is_mod() {1} else {0}; @@ -4638,7 +4638,7 @@ fn sidebar_assoc_items(it: &clean::Item) -> String { out } -fn sidebar_struct(fmt: &mut fmt::Formatter, it: &clean::Item, +fn sidebar_struct(fmt: &mut fmt::Formatter<'_>, it: &clean::Item, s: &clean::Struct) -> fmt::Result { let mut sidebar = String::new(); let fields = get_struct_fields_name(&s.fields); @@ -4675,7 +4675,7 @@ fn is_negative_impl(i: &clean::Impl) -> bool { i.polarity == Some(clean::ImplPolarity::Negative) } -fn sidebar_trait(fmt: &mut fmt::Formatter, it: &clean::Item, +fn sidebar_trait(fmt: &mut fmt::Formatter<'_>, it: &clean::Item, t: &clean::Trait) -> fmt::Result { let mut sidebar = String::new(); @@ -4787,7 +4787,7 @@ fn sidebar_trait(fmt: &mut fmt::Formatter, it: &clean::Item, write!(fmt, "<div class=\"block items\">{}</div>", sidebar) } -fn sidebar_primitive(fmt: &mut fmt::Formatter, it: &clean::Item, +fn sidebar_primitive(fmt: &mut fmt::Formatter<'_>, it: &clean::Item, _p: &clean::PrimitiveType) -> fmt::Result { let sidebar = sidebar_assoc_items(it); @@ -4797,7 +4797,7 @@ fn sidebar_primitive(fmt: &mut fmt::Formatter, it: &clean::Item, Ok(()) } -fn sidebar_typedef(fmt: &mut fmt::Formatter, it: &clean::Item, +fn sidebar_typedef(fmt: &mut fmt::Formatter<'_>, it: &clean::Item, _t: &clean::Typedef) -> fmt::Result { let sidebar = sidebar_assoc_items(it); @@ -4822,7 +4822,7 @@ fn get_struct_fields_name(fields: &[clean::Item]) -> String { .collect() } -fn sidebar_union(fmt: &mut fmt::Formatter, it: &clean::Item, +fn sidebar_union(fmt: &mut fmt::Formatter<'_>, it: &clean::Item, u: &clean::Union) -> fmt::Result { let mut sidebar = String::new(); let fields = get_struct_fields_name(&u.fields); @@ -4840,7 +4840,7 @@ fn sidebar_union(fmt: &mut fmt::Formatter, it: &clean::Item, Ok(()) } -fn sidebar_enum(fmt: &mut fmt::Formatter, it: &clean::Item, +fn sidebar_enum(fmt: &mut fmt::Formatter<'_>, it: &clean::Item, e: &clean::Enum) -> fmt::Result { let mut sidebar = String::new(); @@ -4895,7 +4895,7 @@ fn item_ty_to_strs(ty: &ItemType) -> (&'static str, &'static str) { } } -fn sidebar_module(fmt: &mut fmt::Formatter, _it: &clean::Item, +fn sidebar_module(fmt: &mut fmt::Formatter<'_>, _it: &clean::Item, items: &[clean::Item]) -> fmt::Result { let mut sidebar = String::new(); @@ -4927,7 +4927,7 @@ fn sidebar_module(fmt: &mut fmt::Formatter, _it: &clean::Item, Ok(()) } -fn sidebar_foreign_type(fmt: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result { +fn sidebar_foreign_type(fmt: &mut fmt::Formatter<'_>, it: &clean::Item) -> fmt::Result { let sidebar = sidebar_assoc_items(it); if !sidebar.is_empty() { write!(fmt, "<div class=\"block items\">{}</div>", sidebar)?; @@ -4936,7 +4936,7 @@ fn sidebar_foreign_type(fmt: &mut fmt::Formatter, it: &clean::Item) -> fmt::Resu } impl<'a> fmt::Display for Source<'a> { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { let Source(s) = *self; let lines = s.lines().count(); let mut cols = 0; @@ -4956,7 +4956,7 @@ impl<'a> fmt::Display for Source<'a> { } } -fn item_macro(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, +fn item_macro(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item, t: &clean::Macro) -> fmt::Result { wrap_into_docblock(w, |w| { w.write_str(&highlight::render_with_highlighting(&t.source, @@ -4967,7 +4967,7 @@ fn item_macro(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, document(w, cx, it) } -fn item_proc_macro(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, m: &clean::ProcMacro) +fn item_proc_macro(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item, m: &clean::ProcMacro) -> fmt::Result { let name = it.name.as_ref().expect("proc-macros always have names"); @@ -5000,14 +5000,14 @@ fn item_proc_macro(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, m: &c document(w, cx, it) } -fn item_primitive(w: &mut fmt::Formatter, cx: &Context, +fn item_primitive(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item, _p: &clean::PrimitiveType) -> fmt::Result { document(w, cx, it)?; render_assoc_items(w, cx, it, it.def_id, AssocItemRender::All) } -fn item_keyword(w: &mut fmt::Formatter, cx: &Context, +fn item_keyword(w: &mut fmt::Formatter<'_>, cx: &Context, it: &clean::Item, _p: &str) -> fmt::Result { document(w, cx, it) diff --git a/src/librustdoc/html/toc.rs b/src/librustdoc/html/toc.rs index b3da23060dc..409f2479ccc 100644 --- a/src/librustdoc/html/toc.rs +++ b/src/librustdoc/html/toc.rs @@ -166,13 +166,13 @@ impl TocBuilder { } impl fmt::Debug for Toc { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(self, f) } } impl fmt::Display for Toc { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!(fmt, "<ul>")?; for entry in &self.entries { // recursively format this table of contents (the |
