Skip to content

Commit 346cc05

Browse files
committed
Inline compiler_literal_from_str
This function only made sense when compilers older than 1.54 needed to use a different implementation.
1 parent 2d8dd97 commit 346cc05

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/wrapper.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ macro_rules! unsuffixed_integers {
756756
impl Literal {
757757
pub unsafe fn from_str_unchecked(repr: &str) -> Self {
758758
if inside_proc_macro() {
759-
Literal::Compiler(compiler_literal_from_str(repr).expect("invalid literal"))
759+
Literal::Compiler(proc_macro::Literal::from_str(repr).expect("invalid literal"))
760760
} else {
761761
Literal::Fallback(fallback::Literal::from_str_unchecked(repr))
762762
}
@@ -879,18 +879,15 @@ impl FromStr for Literal {
879879

880880
fn from_str(repr: &str) -> Result<Self, Self::Err> {
881881
if inside_proc_macro() {
882-
compiler_literal_from_str(repr).map(Literal::Compiler)
882+
let literal = proc_macro::Literal::from_str(repr)?;
883+
Ok(Literal::Compiler(literal))
883884
} else {
884885
let literal = fallback::Literal::from_str(repr)?;
885886
Ok(Literal::Fallback(literal))
886887
}
887888
}
888889
}
889890

890-
fn compiler_literal_from_str(repr: &str) -> Result<proc_macro::Literal, LexError> {
891-
proc_macro::Literal::from_str(repr).map_err(LexError::Compiler)
892-
}
893-
894891
impl Display for Literal {
895892
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
896893
match self {

0 commit comments

Comments
 (0)