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.
This commit is contained in:
parent
3feec48d70
commit
2142d014ab
1 changed files with 3 additions and 11 deletions
|
@ -39,18 +39,10 @@ use std::sync::Arc;
|
||||||
|
|
||||||
type CfgSpecs = FxHashSet<(String, Option<String>)>;
|
type CfgSpecs = FxHashSet<(String, Option<String>)>;
|
||||||
|
|
||||||
fn build_session_options_and_crate_config(
|
|
||||||
handler: &mut EarlyErrorHandler,
|
|
||||||
matches: getopts::Matches,
|
|
||||||
) -> (Options, CfgSpecs) {
|
|
||||||
let sessopts = build_session_options(handler, &matches);
|
|
||||||
let cfg = parse_cfgspecs(handler, matches.opt_strs("cfg"));
|
|
||||||
(sessopts, cfg)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn mk_session(handler: &mut EarlyErrorHandler, matches: getopts::Matches) -> (Session, CfgSpecs) {
|
fn mk_session(handler: &mut EarlyErrorHandler, matches: getopts::Matches) -> (Session, CfgSpecs) {
|
||||||
let registry = registry::Registry::new(&[]);
|
let registry = registry::Registry::new(&[]);
|
||||||
let (sessopts, cfg) = build_session_options_and_crate_config(handler, matches);
|
let sessopts = build_session_options(handler, &matches);
|
||||||
|
let cfg = parse_cfgspecs(handler, matches.opt_strs("cfg"));
|
||||||
let temps_dir = sessopts.unstable_opts.temps_dir.as_deref().map(PathBuf::from);
|
let temps_dir = sessopts.unstable_opts.temps_dir.as_deref().map(PathBuf::from);
|
||||||
let io = CompilerIO {
|
let io = CompilerIO {
|
||||||
input: Input::Str { name: FileName::Custom(String::new()), input: String::new() },
|
input: Input::Str { name: FileName::Custom(String::new()), input: String::new() },
|
||||||
|
@ -880,6 +872,6 @@ fn test_edition_parsing() {
|
||||||
let mut handler = EarlyErrorHandler::new(ErrorOutputType::default());
|
let mut handler = EarlyErrorHandler::new(ErrorOutputType::default());
|
||||||
|
|
||||||
let matches = optgroups().parse(&["--edition=2018".to_string()]).unwrap();
|
let matches = optgroups().parse(&["--edition=2018".to_string()]).unwrap();
|
||||||
let (sessopts, _) = build_session_options_and_crate_config(&mut handler, matches);
|
let sessopts = build_session_options(&mut handler, &matches);
|
||||||
assert!(sessopts.edition == Edition::Edition2018)
|
assert!(sessopts.edition == Edition::Edition2018)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue