Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort env vars when writing rust_doc_test runners for consistent outputs #1130

Merged
merged 2 commits into from
Feb 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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