From 16d4bf0fa614965d493bf9b01293b87fc447d2d0 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Wed, 13 Dec 2023 00:23:14 -0500 Subject: [PATCH] Try removing clippy ignore --- crates/ruff_linter/src/message/sarif.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/crates/ruff_linter/src/message/sarif.rs b/crates/ruff_linter/src/message/sarif.rs index b895bb55de2d95..8277c6c90c0153 100644 --- a/crates/ruff_linter/src/message/sarif.rs +++ b/crates/ruff_linter/src/message/sarif.rs @@ -1,10 +1,6 @@ use std::io::Write; -#[cfg(not(target_arch = "wasm32"))] -use url::Url; - -#[allow(unused_imports)] -use anyhow::{anyhow, Result}; +use anyhow::Result; use serde::{Serialize, Serializer}; use serde_json::json; @@ -127,8 +123,8 @@ impl SarifResult { rule: message.kind.rule(), level: "error".to_string(), message: message.kind.name.clone(), - uri: Url::from_file_path(&path) - .map_err(|()| anyhow!("Failed to convert path to URL: {}", path.display()))? + uri: url::Url::from_file_path(&path) + .map_err(|()| anyhow::anyhow!("Failed to convert path to URL: {}", path.display()))? .to_string(), start_line: start_location.row, start_column: start_location.column, @@ -142,12 +138,12 @@ impl SarifResult { fn from_message(message: &Message) -> Result { let start_location = message.compute_start_location(); let end_location = message.compute_end_location(); - let abs_filepath = normalize_path(message.filename()); + let path = normalize_path(message.filename()); Ok(Self { rule: message.kind.rule(), level: "error".to_string(), message: message.kind.name.clone(), - uri: abs_filepath.display().to_string(), + uri: path.display().to_string(), start_line: start_location.row, start_column: start_location.column, end_line: end_location.row,