Skip to content

Commit

Permalink
Upgrade thiserror for dtolnay/thiserror#239
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Jul 7, 2023
1 parent 88a8203 commit 1328d07
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -45,7 +45,7 @@ strum = { version = "0.24.1", features = ["strum_macros"] }
strum_macros = { version = "0.24.3" }
syn = { version = "2.0.15" }
test-case = { version = "3.0.0" }
thiserror = { version = "1.0.41" }
thiserror = { version = "1.0.43" }
toml = { version = "0.7.2" }

# v0.0.1
Expand Down
2 changes: 1 addition & 1 deletion crates/ruff/Cargo.toml
Expand Up @@ -73,7 +73,7 @@ shellexpand = { workspace = true }
smallvec = { workspace = true }
strum = { workspace = true }
strum_macros = { workspace = true }
thiserror = { version = "1.0.38" }
thiserror = { version = "1.0.43" }
toml = { workspace = true }
typed-arena = { version = "2.0.2" }
unicode-width = { version = "0.1.10" }
Expand Down
13 changes: 6 additions & 7 deletions crates/ruff_python_formatter/src/lib.rs
Expand Up @@ -7,10 +7,9 @@ use ruff_formatter::format_element::tag;
use ruff_formatter::prelude::{
dynamic_text, source_position, source_text_slice, text, ContainsNewlines, Formatter, Tag,
};
// `write!` aliased for https://github.com/dtolnay/thiserror/issues/239
use ruff_formatter::{
format, normalize_newlines, write as ruff_write, Buffer, Format, FormatElement, FormatError,
FormatResult, PrintError,
format, normalize_newlines, write, Buffer, Format, FormatElement, FormatError, FormatResult,
PrintError,
};
use ruff_formatter::{Formatted, Printed, SourceCode};
use ruff_python_ast::node::{AnyNodeRef, AstNode, NodeKind};
Expand Down Expand Up @@ -55,9 +54,9 @@ where

/// Formats the node without comments. Ignores any suppression comments.
fn fmt_node(&self, node: &N, f: &mut PyFormatter) -> FormatResult<()> {
ruff_write!(f, [source_position(node.start())])?;
write!(f, [source_position(node.start())])?;
self.fmt_fields(node, f)?;
ruff_write!(f, [source_position(node.end())])
write!(f, [source_position(node.end())])
}

/// Formats the node's fields.
Expand Down Expand Up @@ -228,10 +227,10 @@ impl Format<PyFormatContext<'_>> for VerbatimText {

match normalize_newlines(f.context().locator().slice(self.0), ['\r']) {
Cow::Borrowed(_) => {
ruff_write!(f, [source_text_slice(self.0, ContainsNewlines::Detect)])?;
write!(f, [source_text_slice(self.0, ContainsNewlines::Detect)])?;
}
Cow::Owned(cleaned) => {
ruff_write!(
write!(
f,
[
dynamic_text(&cleaned, Some(self.0.start())),
Expand Down

0 comments on commit 1328d07

Please sign in to comment.