Skip to content

Commit

Permalink
Sort env vars when writing rust_doc_test runners for consistent outpu…
Browse files Browse the repository at this point in the history
…ts (#1130)
  • Loading branch information
UebelAndre committed Feb 9, 2022
1 parent c9e5b63 commit 4499358
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/rustdoc/rustdoc_test_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! code in a single call, can be run as a test target in a hermetic manner.

use std::cmp::Reverse;
use std::collections::{BTreeSet, HashMap};
use std::collections::{BTreeMap, BTreeSet};
use std::env;
use std::fs;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -92,7 +92,7 @@ fn parse_args() -> Options {
/// Write a unix compatible test runner
fn write_test_runner_unix(
path: &Path,
env: &HashMap<String, String>,
env: &BTreeMap<String, String>,
argv: &[String],
strip_substrings: &[String],
) {
Expand Down Expand Up @@ -126,7 +126,7 @@ fn write_test_runner_unix(
/// Write a windows compatible test runner
fn write_test_runner_windows(
path: &Path,
env: &HashMap<String, String>,
env: &BTreeMap<String, String>,
argv: &[String],
strip_substrings: &[String],
) {
Expand Down Expand Up @@ -180,7 +180,7 @@ fn set_executable(_path: &Path) {

fn write_test_runner(
path: &Path,
env: &HashMap<String, String>,
env: &BTreeMap<String, String>,
argv: &[String],
strip_substrings: &[String],
) {
Expand All @@ -196,7 +196,7 @@ fn write_test_runner(
fn main() {
let opt = parse_args();

let env: HashMap<String, String> = env::vars()
let env: BTreeMap<String, String> = env::vars()
.into_iter()
.filter(|(key, _)| opt.env_keys.iter().any(|k| k == key))
.collect();
Expand Down

0 comments on commit 4499358

Please sign in to comment.