Update Rust crate rustc-hash to v2 (#12001)

This commit is contained in:
renovate[bot] 2024-06-23 20:46:42 -04:00 committed by GitHub
parent 446ad0ba44
commit 53a80a5c11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 78 additions and 105 deletions

View file

@ -55,7 +55,11 @@ impl Debug for DebugComments<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let mut map = f.debug_map();
for node in self.comments.keys().sorted_by_key(|key| key.node().start()) {
for node in self
.comments
.keys()
.sorted_by_key(|key| (key.node().start(), key.node().end()))
{
map.entry(
&NodeKindWithSource {
key: *node,
@ -191,11 +195,11 @@ mod tests {
#[test]
fn debug() {
let continue_statement = AnyNode::from(StmtContinue {
range: TextRange::default(),
range: TextRange::new(TextSize::new(18), TextSize::new(26)),
});
let break_statement = AnyNode::from(StmtBreak {
range: TextRange::default(),
range: TextRange::new(TextSize::new(55), TextSize::new(60)),
});
let source = r"# leading comment

View file

@ -5,8 +5,8 @@ expression: comments.debug(source_code)
{
Node {
kind: StmtContinue,
range: 0..0,
source: ``,
range: 18..26,
source: `continue`,
}: {
"leading": [
SourceComment {
@ -26,8 +26,8 @@ expression: comments.debug(source_code)
},
Node {
kind: StmtBreak,
range: 0..0,
source: ``,
range: 55..60,
source: `break`,
}: {
"leading": [
SourceComment {

View file

@ -3,21 +3,6 @@ source: crates/ruff_python_formatter/src/comments/mod.rs
expression: comments.debug(test_case.source_code)
---
{
Node {
kind: ExprBinOp,
range: 30..57,
source: `10 + # More comments⏎`,
}: {
"leading": [
SourceComment {
text: "# Trailing comment",
position: EndOfLine,
formatted: false,
},
],
"dangling": [],
"trailing": [],
},
Node {
kind: ExprNumberLiteral,
range: 30..32,
@ -33,4 +18,19 @@ expression: comments.debug(test_case.source_code)
},
],
},
Node {
kind: ExprBinOp,
range: 30..57,
source: `10 + # More comments⏎`,
}: {
"leading": [
SourceComment {
text: "# Trailing comment",
position: EndOfLine,
formatted: false,
},
],
"dangling": [],
"trailing": [],
},
}