From 5db789df9c767985a564a31cc593ce7f5964100e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 6 Nov 2020 22:52:22 +0100 Subject: Cleanup API --- crates/assists/src/handlers/convert_integer_literal.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/assists/src') diff --git a/crates/assists/src/handlers/convert_integer_literal.rs b/crates/assists/src/handlers/convert_integer_literal.rs index 5957834d3..1094ed3f3 100644 --- a/crates/assists/src/handlers/convert_integer_literal.rs +++ b/crates/assists/src/handlers/convert_integer_literal.rs @@ -14,7 +14,11 @@ use crate::{AssistContext, AssistId, AssistKind, Assists, GroupLabel}; // const _: i32 = 0b1010; // ``` pub(crate) fn convert_integer_literal(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { - let literal = ctx.find_node_at_offset::()?.as_int_number()?; + let literal = ctx.find_node_at_offset::()?; + let literal = match literal.kind() { + ast::LiteralKind::IntNumber(it) => it, + _ => return None, + }; let radix = literal.radix(); let value = literal.value()?; let suffix = literal.suffix(); -- cgit v1.2.3