diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-01-01 19:40:49 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-01-02 19:31:38 +0100 |
| commit | b1aad76586a9816ae577f5338982c4cbcee9a6a5 (patch) | |
| tree | f7d0d3f7ff03c84fabc7839db13fcce341b67e45 /src/libsyntax/lib.rs | |
| parent | 4ff12ce4c14d348dfe53d1f74ab53c878f4fb4f8 (diff) | |
| download | rust-b1aad76586a9816ae577f5338982c4cbcee9a6a5.tar.gz rust-b1aad76586a9816ae577f5338982c4cbcee9a6a5.zip | |
Normalize `syntax::edition` imports.
Diffstat (limited to 'src/libsyntax/lib.rs')
| -rw-r--r-- | src/libsyntax/lib.rs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 3815aa6d774..0b0a19517ec 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -21,7 +21,7 @@ use ast::AttrId; pub use errors; use rustc_data_structures::sync::Lock; use rustc_index::bit_set::GrowableBitSet; -use rustc_span::edition::Edition; +use rustc_span::edition::{Edition, DEFAULT_EDITION}; #[macro_export] macro_rules! unwrap_or { @@ -51,19 +51,13 @@ impl Globals { } } -pub fn with_globals<F, R>(edition: Edition, f: F) -> R -where - F: FnOnce() -> R, -{ +pub fn with_globals<R>(edition: Edition, f: impl FnOnce() -> R) -> R { let globals = Globals::new(edition); GLOBALS.set(&globals, || rustc_span::GLOBALS.set(&globals.rustc_span_globals, f)) } -pub fn with_default_globals<F, R>(f: F) -> R -where - F: FnOnce() -> R, -{ - with_globals(edition::DEFAULT_EDITION, f) +pub fn with_default_globals<R>(f: impl FnOnce() -> R) -> R { + with_globals(DEFAULT_EDITION, f) } scoped_tls::scoped_thread_local!(pub static GLOBALS: Globals); @@ -96,7 +90,6 @@ pub mod mut_visit; pub mod ptr; pub mod show_span; pub use rustc_session::parse as sess; -pub use rustc_span::edition; pub mod token; pub mod tokenstream; pub mod visit; |
