Skip to content

Commit 2d8dd97

Browse files
committed
Delete no_literal_from_str config for rustc older than 1.54
1 parent 3f96a77 commit 2d8dd97

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

build.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ fn main() {
5858
println!("cargo:rustc-cfg=span_locations");
5959
}
6060

61-
if version.minor < 54 {
62-
println!("cargo:rustc-cfg=no_literal_from_str");
63-
}
64-
6561
if version.minor < 55 {
6662
println!("cargo:rustc-cfg=no_group_open_close");
6763
}

src/wrapper.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -888,21 +888,7 @@ impl FromStr for Literal {
888888
}
889889

890890
fn compiler_literal_from_str(repr: &str) -> Result<proc_macro::Literal, LexError> {
891-
#[cfg(not(no_literal_from_str))]
892-
{
893-
proc_macro::Literal::from_str(repr).map_err(LexError::Compiler)
894-
}
895-
#[cfg(no_literal_from_str)]
896-
{
897-
let tokens = proc_macro_parse(repr)?;
898-
let mut iter = tokens.into_iter();
899-
if let (Some(proc_macro::TokenTree::Literal(literal)), None) = (iter.next(), iter.next()) {
900-
if literal.to_string().len() == repr.len() {
901-
return Ok(literal);
902-
}
903-
}
904-
Err(LexError::call_site())
905-
}
891+
proc_macro::Literal::from_str(repr).map_err(LexError::Compiler)
906892
}
907893

908894
impl Display for Literal {

0 commit comments

Comments
 (0)