mirror of https://github.com/astral-sh/ruff
Remove custom serialization for Location (#104)
This commit is contained in:
parent
3cf9e3b201
commit
a3fb0d6c20
|
|
@ -7,25 +7,9 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::checks::CheckKind;
|
use crate::checks::CheckKind;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
#[serde(remote = "Location")]
|
|
||||||
struct LocationDef {
|
|
||||||
#[serde(getter = "Location::row")]
|
|
||||||
row: usize,
|
|
||||||
#[serde(getter = "Location::column")]
|
|
||||||
column: usize,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<LocationDef> for Location {
|
|
||||||
fn from(def: LocationDef) -> Location {
|
|
||||||
Location::new(def.row, def.column)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
pub struct Message {
|
pub struct Message {
|
||||||
pub kind: CheckKind,
|
pub kind: CheckKind,
|
||||||
#[serde(with = "LocationDef")]
|
|
||||||
pub location: Location,
|
pub location: Location,
|
||||||
pub filename: String,
|
pub filename: String,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue