Skip to content

Commit

Permalink
chore: update error report
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari committed Aug 14, 2023
1 parent 67ca9cb commit 1e3c8b0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/ruff_fmt/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ use std::borrow::Cow;

use ruff_formatter::{IndentStyle as RuffIndentStyle, LineWidth};
use ruff_python_formatter::{MagicTrailingComma, PyFormatOptions, QuoteStyle};
use serde::{de::Error, Deserialize, Deserializer};
use serde::{
de::{Error, Unexpected},
Deserialize, Deserializer,
};
use wasm_bindgen::prelude::wasm_bindgen;

#[wasm_bindgen(typescript_custom_section)]
Expand Down Expand Up @@ -67,7 +70,9 @@ impl<'de> Deserialize<'de> for IndentStyle {
match IndentStyle::deserialize(deserializer)? {
IndentStyle::Space(n) => Ok(Self::Space(n)),
IndentStyle::Tab(c) if c == "tab" => Ok(Self::Tab),
IndentStyle::Tab(other) => Err(Error::unknown_variant(&other, &["number", "\"tab\""])),
IndentStyle::Tab(other) => {
Err(D::Error::invalid_value(Unexpected::Str(&other), &"<number> or `tab`"))
}
}
}
}
Expand Down

0 comments on commit 1e3c8b0

Please sign in to comment.