Skip to content

Commit d74c0f4

Browse files
committed
Streamline rustc_interface tests.
In `test_edition_parsing`, change the `build_session_options_and_crate_config` call to `build_session_options`, because the config isn't used. That leaves a single call site for `build_session_options_and_crate_config`, so just inline and remove it.
1 parent 8e76d13 commit d74c0f4

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

compiler/rustc_interface/src/tests.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,10 @@ use std::path::{Path, PathBuf};
3838

3939
type CfgSpecs = FxHashSet<(String, Option<String>)>;
4040

41-
fn build_session_options_and_crate_config(
42-
handler: &mut EarlyErrorHandler,
43-
matches: getopts::Matches,
44-
) -> (Options, CfgSpecs) {
45-
let sessopts = build_session_options(handler, &matches);
46-
let cfg = parse_cfgspecs(handler, matches.opt_strs("cfg"));
47-
(sessopts, cfg)
48-
}
49-
5041
fn mk_session(handler: &mut EarlyErrorHandler, matches: getopts::Matches) -> (Session, CfgSpecs) {
5142
let registry = registry::Registry::new(&[]);
52-
let (sessopts, cfg) = build_session_options_and_crate_config(handler, matches);
43+
let sessopts = build_session_options(handler, &matches);
44+
let cfg = parse_cfgspecs(handler, matches.opt_strs("cfg"));
5345
let temps_dir = sessopts.unstable_opts.temps_dir.as_deref().map(PathBuf::from);
5446
let io = CompilerIO {
5547
input: Input::Str { name: FileName::Custom(String::new()), input: String::new() },
@@ -879,6 +871,6 @@ fn test_edition_parsing() {
879871
let mut handler = EarlyErrorHandler::new(ErrorOutputType::default());
880872

881873
let matches = optgroups().parse(&["--edition=2018".to_string()]).unwrap();
882-
let (sessopts, _) = build_session_options_and_crate_config(&mut handler, matches);
874+
let sessopts = build_session_options(&mut handler, &matches);
883875
assert!(sessopts.edition == Edition::Edition2018)
884876
}

0 commit comments

Comments
 (0)