Skip to content

Commit

Permalink
Use BTreeMap in build_sidebar_items
Browse files Browse the repository at this point in the history
This ensures that later when generating HTML, the JSON will be sorted aswell.
We now have a deterministic build of sidebar-items.js
  • Loading branch information
mvdnes committed Apr 16, 2015
1 parent 798fa22 commit 61ad9fe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub use self::ExternalLocation::*;
use std::ascii::OwnedAsciiExt;
use std::cell::RefCell;
use std::cmp::Ordering;
use std::collections::{HashMap, HashSet};
use std::collections::{BTreeMap, HashMap, HashSet};
use std::default::Default;
use std::fmt;
use std::fs::{self, File};
Expand Down Expand Up @@ -1319,8 +1319,9 @@ impl Context {
}
}

fn build_sidebar_items(&self, m: &clean::Module) -> HashMap<String, Vec<NameDoc>> {
let mut map = HashMap::new();
fn build_sidebar_items(&self, m: &clean::Module) -> BTreeMap<String, Vec<NameDoc>> {
// BTreeMap instead of HashMap to get a sorted output
let mut map = BTreeMap::new();
for item in &m.items {
if self.ignore_private_item(item) { continue }

Expand Down

0 comments on commit 61ad9fe

Please sign in to comment.