Skip to content

Commit 2142d01

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 3feec48 commit 2142d01

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
@@ -39,18 +39,10 @@ use std::sync::Arc;
3939

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

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

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

0 commit comments

Comments
 (0)