Use BTreeMap in build_sidebar_items

This ensures that later when generating HTML, the JSON will be sorted aswell.
We now have a deterministic build of sidebar-items.js
This commit is contained in:
Mathijs van de Nes 2015-04-16 12:14:45 +02:00 committed by Steve Klabnik
parent e12671b4d7
commit 32956cb565

View File

@ -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};
@ -1298,8 +1298,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 }