diff options
| author | QuietMisdreavus <grey@quietmisdreavus.net> | 2019-04-19 08:54:26 -0500 |
|---|---|---|
| committer | QuietMisdreavus <grey@quietmisdreavus.net> | 2019-05-06 15:20:18 -0500 |
| commit | 76b49007f3400a6bc5af5586c2a31121c2525568 (patch) | |
| tree | 69c3e2e3ecfcb0819691d63da53ab3e27c72a498 /src | |
| parent | e61ff7717e6936929c3fb7cdb001383c64105cf3 (diff) | |
| download | rust-76b49007f3400a6bc5af5586c2a31121c2525568.tar.gz rust-76b49007f3400a6bc5af5586c2a31121c2525568.zip | |
don't pre-allocate the default edition string
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/config.rs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 0a403f61e9c..d17d27271ce 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -13,7 +13,7 @@ use rustc::session::config::{nightly_options, build_codegen_options, build_debug use rustc::session::search_paths::SearchPath; use rustc_driver; use rustc_target::spec::TargetTriple; -use syntax::edition::Edition; +use syntax::edition::{Edition, DEFAULT_EDITION}; use crate::core::new_handler; use crate::externalfiles::ExternalHtml; @@ -386,13 +386,16 @@ impl Options { } } - let edition = matches.opt_str("edition").unwrap_or("2015".to_string()); - let edition = match edition.parse() { - Ok(e) => e, - Err(_) => { - diag.struct_err("could not parse edition").emit(); - return Err(1); + let edition = if let Some(e) = matches.opt_str("edition") { + match e.parse() { + Ok(e) => e, + Err(_) => { + diag.struct_err("could not parse edition").emit(); + return Err(1); + } } + } else { + DEFAULT_EDITION }; let mut id_map = html::markdown::IdMap::new(); |
