// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![allow(deprecated)]
-
use std::cell::{RefCell, Cell};
-use std::collections::{HashSet, HashMap};
-use std::dynamic_lib::DynamicLibrary;
+use std::collections::HashMap;
use std::env;
use std::ffi::OsString;
use std::io::prelude::*;
use rustc::session::config::{get_unstable_features_setting, OutputType};
use rustc::session::search_paths::{SearchPaths, PathKind};
use rustc_front::lowering::{lower_crate, LoweringContext};
+use rustc_back::dynamic_lib::DynamicLibrary;
use rustc_back::tempdir::TempDir;
use rustc_driver::{driver, Compilation};
use rustc_metadata::cstore::CStore;
let mut cfg = config::build_configuration(&sess);
cfg.extend(config::parse_cfgspecs(cfgs.clone()));
- let krate = driver::phase_1_parse_input(&sess, cfg, &input);
+ let krate = panictry!(driver::phase_1_parse_input(&sess, cfg, &input));
let krate = driver::phase_2_configure_and_expand(&sess, &cstore, krate,
"rustdoc-test", None)
.expect("phase_2_configure_and_expand aborted in rustdoc!");
external_traits: RefCell::new(None),
external_typarams: RefCell::new(None),
inlined: RefCell::new(None),
- populated_crate_impls: RefCell::new(HashSet::new()),
+ all_crate_impls: RefCell::new(HashMap::new()),
deref_trait_did: Cell::new(None),
};
let mut v = RustdocVisitor::new(&ctx, None);
v.visit(ctx.map.krate());
let mut krate = v.clean(&ctx);
- match crate_name {
- Some(name) => krate.name = name,
- None => {}
+ if let Some(name) = crate_name {
+ krate.name = name;
}
let (krate, _) = passes::collapse_docs(krate);
let (krate, _) = passes::unindent_comments(krate);
// Don't inject `extern crate std` because it's already injected by the
// compiler.
if !s.contains("extern crate") && !opts.no_crate_inject && cratename != Some("std") {
- match cratename {
- Some(cratename) => {
- if s.contains(cratename) {
- prog.push_str(&format!("extern crate {};\n", cratename));
- }
+ if let Some(cratename) = cratename {
+ if s.contains(cratename) {
+ prog.push_str(&format!("extern crate {};\n", cratename));
}
- None => {}
}
}
if dont_insert_main || s.contains("fn main") {
_ => typename_if_impl(&item)
};
- let pushed = if let Some(name) = current_name {
- self.names.push(name);
- true
- } else {
- false
- };
+ let pushed = current_name.map(|name| self.names.push(name)).is_some();
if let Some(doc) = item.doc_value() {
self.cnt = 0;