Skip to content

Commit

Permalink
Remove CURRENT_DEPTH
Browse files Browse the repository at this point in the history
Hooray!
  • Loading branch information
camelid committed Mar 6, 2021
1 parent 80a0dc2 commit 0e1ff40
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
10 changes: 1 addition & 9 deletions src/librustdoc/html/render/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use super::print_item::{full_path, item_path, print_item};
use super::write_shared::write_shared;
use super::{
print_sidebar, settings, AllTypes, NameDoc, SharedContext, StylePath, BASIC_KEYWORDS,
CURRENT_DEPTH, INITIAL_IDS,
INITIAL_IDS,
};

use crate::clean::{self, AttributesExt};
Expand Down Expand Up @@ -106,12 +106,6 @@ impl<'tcx> Context<'tcx> {
}

fn render_item(&self, it: &clean::Item, pushname: bool) -> String {
// A little unfortunate that this is done like this, but it sure
// does make formatting *a lot* nicer.
CURRENT_DEPTH.with(|slot| {
slot.set(self.current.len());
});

let mut title = if it.is_primitive() || it.is_keyword() {
// No need to include the namespace for primitive types and keywords
String::new()
Expand Down Expand Up @@ -422,8 +416,6 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
redirections: if generate_redirect_map { Some(Default::default()) } else { None },
};

CURRENT_DEPTH.with(|s| s.set(0));

// Write shared runs within a flock; disable thread dispatching of IO temporarily.
Arc::get_mut(&mut cx.shared).unwrap().fs.set_sync_only(true);
write_shared(&cx, &krate, index, &md_opts)?;
Expand Down
4 changes: 1 addition & 3 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mod write_shared;

crate use context::*;

use std::cell::{Cell, RefCell};
use std::cell::RefCell;
use std::collections::VecDeque;
use std::default::Default;
use std::fmt;
Expand Down Expand Up @@ -291,8 +291,6 @@ crate struct StylePath {
crate disabled: bool,
}

thread_local!(crate static CURRENT_DEPTH: Cell<usize> = Cell::new(0));

crate const INITIAL_IDS: [&'static str; 15] = [
"main",
"search",
Expand Down

0 comments on commit 0e1ff40

Please sign in to comment.