Skip to content

Commit 1932d7a

Browse files
committed
Transition librustdoc to 2018 edition
1 parent 082c861 commit 1932d7a

36 files changed

+419
-423
lines changed

src/librustdoc/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
authors = ["The Rust Project Developers"]
33
name = "rustdoc"
44
version = "0.0.0"
5+
edition = "2018"
56

67
[lib]
78
name = "rustdoc"

src/librustdoc/clean/auto_trait.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
220220
}
221221
}
222222

223-
fn get_lifetime(&self, region: Region, names_map: &FxHashMap<String, Lifetime>) -> Lifetime {
223+
fn get_lifetime(&self, region: Region<'_>, names_map: &FxHashMap<String, Lifetime>) -> Lifetime {
224224
self.region_name(region)
225225
.map(|name| {
226226
names_map.get(&name).unwrap_or_else(|| {
@@ -231,7 +231,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
231231
.clone()
232232
}
233233

234-
fn region_name(&self, region: Region) -> Option<String> {
234+
fn region_name(&self, region: Region<'_>) -> Option<String> {
235235
match region {
236236
&ty::ReEarlyBound(r) => Some(r.name.to_string()),
237237
_ => None,
@@ -259,7 +259,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
259259
// we need to create the Generics.
260260
let mut finished: FxHashMap<_, Vec<_>> = Default::default();
261261

262-
let mut vid_map: FxHashMap<RegionTarget, RegionDeps> = Default::default();
262+
let mut vid_map: FxHashMap<RegionTarget<'_>, RegionDeps<'_>> = Default::default();
263263

264264
// Flattening is done in two parts. First, we insert all of the constraints
265265
// into a map. Each RegionTarget (either a RegionVid or a Region) maps
@@ -842,7 +842,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
842842
vec.sort_by_cached_key(|x| format!("{:?}", x))
843843
}
844844

845-
fn is_fn_ty(&self, tcx: &TyCtxt, ty: &Type) -> bool {
845+
fn is_fn_ty(&self, tcx: &TyCtxt<'_, '_, '_>, ty: &Type) -> bool {
846846
match &ty {
847847
&&Type::ResolvedPath { ref did, .. } => {
848848
*did == tcx.require_lang_item(lang_items::FnTraitLangItem)

src/librustdoc/clean/blanket_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc::ty::subst::Subst;
55
use rustc::infer::InferOk;
66
use syntax_pos::DUMMY_SP;
77

8-
use core::DocAccessLevels;
8+
use crate::core::DocAccessLevels;
99

1010
use super::*;
1111

src/librustdoc/clean/cfg.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use syntax::feature_gate::Features;
1414

1515
use syntax_pos::Span;
1616

17-
use html::escape::Escape;
17+
use crate::html::escape::Escape;
1818

1919
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, PartialEq, Eq, Hash)]
2020
pub enum Cfg {
@@ -261,7 +261,7 @@ impl ops::BitOr for Cfg {
261261
struct Html<'a>(&'a Cfg, bool);
262262

263263
fn write_with_opt_paren<T: fmt::Display>(
264-
fmt: &mut fmt::Formatter,
264+
fmt: &mut fmt::Formatter<'_>,
265265
has_paren: bool,
266266
obj: T,
267267
) -> fmt::Result {
@@ -277,7 +277,7 @@ fn write_with_opt_paren<T: fmt::Display>(
277277

278278

279279
impl<'a> fmt::Display for Html<'a> {
280-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
280+
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
281281
match *self.0 {
282282
Cfg::Not(ref child) => match **child {
283283
Cfg::Any(ref sub_cfgs) => {

src/librustdoc/clean/def_ctor.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use core::DocContext;
1+
use crate::core::DocContext;
22

33
use super::*;
44

5-
pub fn get_def_from_def_id<F>(cx: &DocContext,
5+
pub fn get_def_from_def_id<F>(cx: &DocContext<'_, '_, '_>,
66
def_id: DefId,
77
callback: &F,
88
) -> Vec<Item>
@@ -38,7 +38,7 @@ where F: Fn(& dyn Fn(DefId) -> Def) -> Vec<Item> {
3838
}
3939
}
4040

41-
pub fn get_def_from_node_id<F>(cx: &DocContext,
41+
pub fn get_def_from_node_id<F>(cx: &DocContext<'_, '_, '_>,
4242
id: ast::NodeId,
4343
name: String,
4444
callback: &F,

src/librustdoc/clean/inline.rs

+22-22
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use rustc_metadata::cstore::LoadedMacro;
1313
use rustc::ty;
1414
use rustc::util::nodemap::FxHashSet;
1515

16-
use core::{DocContext, DocAccessLevels};
17-
use doctree;
18-
use clean::{
16+
use crate::core::{DocContext, DocAccessLevels};
17+
use crate::doctree;
18+
use crate::clean::{
1919
self,
2020
GetDefId,
2121
ToSource,
@@ -35,7 +35,7 @@ use super::Clean;
3535
///
3636
/// The returned value is `None` if the definition could not be inlined,
3737
/// and `Some` of a vector of items if it was successfully expanded.
38-
pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name, visited: &mut FxHashSet<DefId>)
38+
pub fn try_inline(cx: &DocContext<'_, '_, '_>, def: Def, name: ast::Name, visited: &mut FxHashSet<DefId>)
3939
-> Option<Vec<clean::Item>> {
4040
let did = if let Some(did) = def.opt_def_id() {
4141
did
@@ -124,7 +124,7 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name, visited: &mut FxHa
124124
Some(ret)
125125
}
126126

127-
pub fn try_inline_glob(cx: &DocContext, def: Def, visited: &mut FxHashSet<DefId>)
127+
pub fn try_inline_glob(cx: &DocContext<'_, '_, '_>, def: Def, visited: &mut FxHashSet<DefId>)
128128
-> Option<Vec<clean::Item>>
129129
{
130130
if def == Def::Err { return None }
@@ -141,15 +141,15 @@ pub fn try_inline_glob(cx: &DocContext, def: Def, visited: &mut FxHashSet<DefId>
141141
}
142142
}
143143

144-
pub fn load_attrs(cx: &DocContext, did: DefId) -> clean::Attributes {
144+
pub fn load_attrs(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Attributes {
145145
cx.tcx.get_attrs(did).clean(cx)
146146
}
147147

148148
/// Record an external fully qualified name in the external_paths cache.
149149
///
150150
/// These names are used later on by HTML rendering to generate things like
151151
/// source links back to the original item.
152-
pub fn record_extern_fqn(cx: &DocContext, did: DefId, kind: clean::TypeKind) {
152+
pub fn record_extern_fqn(cx: &DocContext<'_, '_, '_>, did: DefId, kind: clean::TypeKind) {
153153
let mut crate_name = cx.tcx.crate_name(did.krate).to_string();
154154
if did.is_local() {
155155
crate_name = cx.crate_name.clone().unwrap_or(crate_name);
@@ -177,7 +177,7 @@ pub fn record_extern_fqn(cx: &DocContext, did: DefId, kind: clean::TypeKind) {
177177
}
178178
}
179179

180-
pub fn build_external_trait(cx: &DocContext, did: DefId) -> clean::Trait {
180+
pub fn build_external_trait(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Trait {
181181
let auto_trait = cx.tcx.trait_def(did).has_auto_impl;
182182
let trait_items = cx.tcx.associated_items(did).map(|item| item.clean(cx)).collect();
183183
let predicates = cx.tcx.predicates_of(did);
@@ -197,7 +197,7 @@ pub fn build_external_trait(cx: &DocContext, did: DefId) -> clean::Trait {
197197
}
198198
}
199199

200-
fn build_external_function(cx: &DocContext, did: DefId) -> clean::Function {
200+
fn build_external_function(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Function {
201201
let sig = cx.tcx.fn_sig(did);
202202

203203
let constness = if cx.tcx.is_min_const_fn(did) {
@@ -219,7 +219,7 @@ fn build_external_function(cx: &DocContext, did: DefId) -> clean::Function {
219219
}
220220
}
221221

222-
fn build_enum(cx: &DocContext, did: DefId) -> clean::Enum {
222+
fn build_enum(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Enum {
223223
let predicates = cx.tcx.predicates_of(did);
224224

225225
clean::Enum {
@@ -229,7 +229,7 @@ fn build_enum(cx: &DocContext, did: DefId) -> clean::Enum {
229229
}
230230
}
231231

232-
fn build_struct(cx: &DocContext, did: DefId) -> clean::Struct {
232+
fn build_struct(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Struct {
233233
let predicates = cx.tcx.predicates_of(did);
234234
let variant = cx.tcx.adt_def(did).non_enum_variant();
235235

@@ -245,7 +245,7 @@ fn build_struct(cx: &DocContext, did: DefId) -> clean::Struct {
245245
}
246246
}
247247

248-
fn build_union(cx: &DocContext, did: DefId) -> clean::Union {
248+
fn build_union(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Union {
249249
let predicates = cx.tcx.predicates_of(did);
250250
let variant = cx.tcx.adt_def(did).non_enum_variant();
251251

@@ -257,7 +257,7 @@ fn build_union(cx: &DocContext, did: DefId) -> clean::Union {
257257
}
258258
}
259259

260-
fn build_type_alias(cx: &DocContext, did: DefId) -> clean::Typedef {
260+
fn build_type_alias(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Typedef {
261261
let predicates = cx.tcx.predicates_of(did);
262262

263263
clean::Typedef {
@@ -266,7 +266,7 @@ fn build_type_alias(cx: &DocContext, did: DefId) -> clean::Typedef {
266266
}
267267
}
268268

269-
pub fn build_impls(cx: &DocContext, did: DefId) -> Vec<clean::Item> {
269+
pub fn build_impls(cx: &DocContext<'_, '_, '_>, did: DefId) -> Vec<clean::Item> {
270270
let tcx = cx.tcx;
271271
let mut impls = Vec::new();
272272

@@ -277,7 +277,7 @@ pub fn build_impls(cx: &DocContext, did: DefId) -> Vec<clean::Item> {
277277
impls
278278
}
279279

280-
pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec<clean::Item>) {
280+
pub fn build_impl(cx: &DocContext<'_, '_, '_>, did: DefId, ret: &mut Vec<clean::Item>) {
281281
if !cx.renderinfo.borrow_mut().inlined.insert(did) {
282282
return
283283
}
@@ -387,15 +387,15 @@ pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec<clean::Item>) {
387387
});
388388
}
389389

390-
fn build_module(cx: &DocContext, did: DefId, visited: &mut FxHashSet<DefId>) -> clean::Module {
390+
fn build_module(cx: &DocContext<'_, '_, '_>, did: DefId, visited: &mut FxHashSet<DefId>) -> clean::Module {
391391
let mut items = Vec::new();
392392
fill_in(cx, did, &mut items, visited);
393393
return clean::Module {
394394
items,
395395
is_crate: false,
396396
};
397397

398-
fn fill_in(cx: &DocContext, did: DefId, items: &mut Vec<clean::Item>,
398+
fn fill_in(cx: &DocContext<'_, '_, '_>, did: DefId, items: &mut Vec<clean::Item>,
399399
visited: &mut FxHashSet<DefId>) {
400400
// If we're re-exporting a re-export it may actually re-export something in
401401
// two namespaces, so the target may be listed twice. Make sure we only
@@ -412,30 +412,30 @@ fn build_module(cx: &DocContext, did: DefId, visited: &mut FxHashSet<DefId>) ->
412412
}
413413
}
414414

415-
pub fn print_inlined_const(cx: &DocContext, did: DefId) -> String {
415+
pub fn print_inlined_const(cx: &DocContext<'_, '_, '_>, did: DefId) -> String {
416416
if let Some(node_id) = cx.tcx.hir().as_local_node_id(did) {
417417
cx.tcx.hir().node_to_pretty_string(node_id)
418418
} else {
419419
cx.tcx.rendered_const(did)
420420
}
421421
}
422422

423-
fn build_const(cx: &DocContext, did: DefId) -> clean::Constant {
423+
fn build_const(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Constant {
424424
clean::Constant {
425425
type_: cx.tcx.type_of(did).clean(cx),
426426
expr: print_inlined_const(cx, did)
427427
}
428428
}
429429

430-
fn build_static(cx: &DocContext, did: DefId, mutable: bool) -> clean::Static {
430+
fn build_static(cx: &DocContext<'_, '_, '_>, did: DefId, mutable: bool) -> clean::Static {
431431
clean::Static {
432432
type_: cx.tcx.type_of(did).clean(cx),
433433
mutability: if mutable {clean::Mutable} else {clean::Immutable},
434434
expr: "\n\n\n".to_string(), // trigger the "[definition]" links
435435
}
436436
}
437437

438-
fn build_macro(cx: &DocContext, did: DefId, name: ast::Name) -> clean::ItemEnum {
438+
fn build_macro(cx: &DocContext<'_, '_, '_>, did: DefId, name: ast::Name) -> clean::ItemEnum {
439439
let imported_from = cx.tcx.original_crate_name(did.krate);
440440
match cx.cstore.load_macro_untracked(did, cx.sess()) {
441441
LoadedMacro::MacroDef(def) => {
@@ -537,7 +537,7 @@ fn separate_supertrait_bounds(mut g: clean::Generics)
537537
(g, ty_bounds)
538538
}
539539

540-
pub fn record_extern_trait(cx: &DocContext, did: DefId) {
540+
pub fn record_extern_trait(cx: &DocContext<'_, '_, '_>, did: DefId) {
541541
if did.is_local() {
542542
return;
543543
}

0 commit comments

Comments
 (0)