diff --git a/crates/proc-macro-srv/src/server.rs b/crates/proc-macro-srv/src/server.rs index 9961c5910a..af50e1b70d 100644 --- a/crates/proc-macro-srv/src/server.rs +++ b/crates/proc-macro-srv/src/server.rs @@ -55,8 +55,8 @@ fn spacing_to_external(spacing: Spacing) -> proc_macro::Spacing { } } -fn literal_to_external(literal: ast::LiteralKind) -> Option { - Some(match lit.kind() { +fn literal_to_external(literal_kind: ast::LiteralKind) -> Option { + Some(match literal_kind { ast::LiteralKind::String(data) => { if data.is_raw() { bridge::LitKind::StrRaw(data.raw_delimiter_count()?) diff --git a/crates/proc-macro-srv/src/server/rust_analyzer_span.rs b/crates/proc-macro-srv/src/server/rust_analyzer_span.rs index f52a4875b0..dce4c60b2f 100644 --- a/crates/proc-macro-srv/src/server/rust_analyzer_span.rs +++ b/crates/proc-macro-srv/src/server/rust_analyzer_span.rs @@ -4,7 +4,6 @@ //! It is an unfortunate result of how the proc-macro API works that we need to look into the //! concrete representation of the spans, and as such, RustRover cannot make use of this unless they //! change their representation to be compatible with rust-analyzer's. -use core::num; use std::{ collections::{HashMap, HashSet}, iter, @@ -72,13 +71,14 @@ impl server::FreeFunctions for RaSpanServer { &mut self, s: &str, ) -> Result, ()> { - let literal = str_to_lit_node(s).ok_or(Err(()))?; + let literal = str_to_lit_node(s).ok_or(())?; - let kind = literal_to_external(literal.kind()).ok_or(Err(()))?; + let kind = literal_to_external(literal.kind()).ok_or(())?; // FIXME: handle more than just int and float suffixes let suffix = match literal.kind() { - ast::LiteralKind::FloatNumber(num) | ast::LiteralKind::IntNumber(num) => num.suffix(), + ast::LiteralKind::FloatNumber(num) => num.suffix(), + ast::LiteralKind::IntNumber(num) => num.suffix(), _ => None, } .map(|suffix| Symbol::intern(self.interner, suffix)); diff --git a/crates/proc-macro-srv/src/server/token_id.rs b/crates/proc-macro-srv/src/server/token_id.rs index d5f7359255..b237522874 100644 --- a/crates/proc-macro-srv/src/server/token_id.rs +++ b/crates/proc-macro-srv/src/server/token_id.rs @@ -63,13 +63,14 @@ impl server::FreeFunctions for TokenIdServer { &mut self, s: &str, ) -> Result, ()> { - let literal = str_to_lit_node(s).ok_or(Err(()))?; + let literal = str_to_lit_node(s).ok_or(())?; - let kind = literal_to_external(literal.kind()).ok_or(Err(()))?; + let kind = literal_to_external(literal.kind()).ok_or(())?; // FIXME: handle more than just int and float suffixes let suffix = match literal.kind() { - ast::LiteralKind::FloatNumber(num) | ast::LiteralKind::IntNumber(num) => num.suffix(), + ast::LiteralKind::FloatNumber(num) => num.suffix(), + ast::LiteralKind::IntNumber(num) => num.suffix(), _ => None, } .map(|suffix| Symbol::intern(self.interner, suffix));