Skip to content

Commit

Permalink
Fixed lints
Browse files Browse the repository at this point in the history
  • Loading branch information
integraledelebesgue committed Oct 14, 2024
1 parent a65d499 commit 18e189c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/cairo-lang-language-server/src/ide/hover/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn hover(params: HoverParams, db: &AnalysisDatabase) -> Option<Hover> {

if let Some(hover) = db
.find_identifier_at_position(file_id, position)
.map(|ref id| render::definition(db, &id, file_id).or_else(|| render::legacy(db, &id)))
.map(|ref id| render::definition(db, id, file_id).or_else(|| render::legacy(db, id)))
{
return hover;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ pub fn number(
let number_type = type_suffix.as_ref().map(SmolStr::as_str).unwrap_or("felt252");
let type_path = if number_type == "felt252" { "core" } else { "core::integer" };

let representation = String::from(formatdoc!(
let representation = formatdoc!(
"
{TITLE}: `{value} ({value:#x} | {value:#b})`
{RULER}
Type: `{type_path}::{number_type}`
"
));
);

Some(Hover { contents: markdown_contents(representation), range: literal.range(db, file_id) })
}
Expand All @@ -58,13 +58,13 @@ pub fn number(
pub fn string(db: &AnalysisDatabase, literal: &TerminalString, file_id: FileId) -> Option<Hover> {
let string = literal.string_value(db)?;

let representation = String::from(formatdoc!(
let representation = formatdoc!(
r#"
{TITLE}: `"{string}"`
{RULER}
Type: `core::byte_array::ByteArray`
"#
));
);

Some(Hover { contents: markdown_contents(representation), range: literal.range(db, file_id) })
}
Expand All @@ -79,20 +79,20 @@ pub fn short_string(
) -> Option<Hover> {
let representation = match (literal.numeric_value(db), literal.string_value(db)) {
(None, _) => None,
(Some(numeric), None) => Some(String::from(formatdoc!(
(Some(numeric), None) => Some(formatdoc!(
"
{TITLE}: `{numeric:#x}`
{RULER}
Type: `core::felt252`
"
))),
(Some(numeric), Some(string)) => Some(String::from(formatdoc!(
)),
(Some(numeric), Some(string)) => Some(formatdoc!(
"
{TITLE}: `'{string}' ({numeric:#x})`
{RULER}
Type: `core::felt252`
"
))),
)),
}?;

Some(Hover { contents: markdown_contents(representation), range: literal.range(db, file_id) })
Expand Down

0 comments on commit 18e189c

Please sign in to comment.