-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
std
crate via ::std
instead of private mod
This change tries to optimize for simplicity and compile time. It's extremely unlikely that users do `extern crate std as x`, so we can simplify this code to not rely on `private_mod`. This is motivated by simplifying code for future additions.
- Loading branch information
Showing
5 changed files
with
54 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//! Token generation utilities. | ||
//! | ||
//! These use items from the standard library as `::std`. This works unless | ||
//! users do `extern crate x as std`, which is extremely unlikely. | ||
use proc_macro2::TokenStream; | ||
use quote::quote; | ||
|
||
pub fn option_some() -> TokenStream { | ||
quote!(::std::option::Option::Some) | ||
} | ||
|
||
pub fn option_none() -> TokenStream { | ||
quote!(::std::option::Option::None) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters