Skip to content

Commit ba1a845

Browse files
committed
Delete parent field on DiagnosticMessage and CacheMessage
Summary -- Deletes the unused `parent` field on two structs, which should make converting these to the new `Diagnostic` type a little easier. It looks like I accidentally added both of these in #16837 in an early commit that I only partially reverted, so they have never actually been used. Test Plan -- Existing tests
1 parent e515899 commit ba1a845

File tree

5 files changed

+0
-27
lines changed

5 files changed

+0
-27
lines changed

crates/ruff/src/cache.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ impl FileCache {
353353
fix: msg.fix.clone(),
354354
file: file.clone(),
355355
noqa_offset: msg.noqa_offset,
356-
parent: msg.parent,
357356
})
358357
})
359358
.collect()
@@ -446,7 +445,6 @@ impl LintCacheData {
446445
CacheMessage {
447446
kind: msg.kind.clone(),
448447
range: msg.range,
449-
parent: msg.parent,
450448
fix: msg.fix.clone(),
451449
noqa_offset: msg.noqa_offset,
452450
}
@@ -467,7 +465,6 @@ pub(super) struct CacheMessage {
467465
kind: DiagnosticKind,
468466
/// Range into the message's [`FileCache::source`].
469467
range: TextRange,
470-
parent: Option<TextSize>,
471468
fix: Option<Fix>,
472469
noqa_offset: TextSize,
473470
}

crates/ruff_linter/src/fix/edits.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,6 @@ x = 1 \
749749
kind: diag.kind,
750750
range: diag.range,
751751
fix: diag.fix,
752-
parent: diag.parent,
753752
file: SourceFileBuilder::new("<filename>", "<code>").finish(),
754753
noqa_offset: TextSize::default(),
755754
}

crates/ruff_linter/src/fix/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ mod tests {
184184
kind: MissingNewlineAtEndOfFile.into(),
185185
range: edit.range(),
186186
fix: Some(Fix::safe_edit(edit)),
187-
parent: None,
188187
file: SourceFileBuilder::new(filename, source).finish(),
189188
noqa_offset: TextSize::default(),
190189
})

crates/ruff_linter/src/message/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ pub struct DiagnosticMessage {
5454
pub kind: DiagnosticKind,
5555
pub range: TextRange,
5656
pub fix: Option<Fix>,
57-
pub parent: Option<TextSize>,
5857
pub file: SourceFile,
5958
pub noqa_offset: TextSize,
6059
}
@@ -93,7 +92,6 @@ impl Message {
9392
range: diagnostic.range(),
9493
kind: diagnostic.kind,
9594
fix: diagnostic.fix,
96-
parent: diagnostic.parent,
9795
file,
9896
noqa_offset,
9997
})

crates/ruff_linter/src/noqa.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -862,26 +862,6 @@ fn find_noqa_comments<'a>(
862862
}
863863
}
864864

865-
// Is the violation ignored by a `noqa` directive on the parent line?
866-
if let Some(parent) = diagnostic.parent {
867-
if let Some(directive_line) =
868-
directives.find_line_with_directive(noqa_line_for.resolve(parent))
869-
{
870-
match &directive_line.directive {
871-
Directive::All(_) => {
872-
comments_by_line.push(None);
873-
continue;
874-
}
875-
Directive::Codes(codes) => {
876-
if codes.includes(diagnostic.kind.rule()) {
877-
comments_by_line.push(None);
878-
continue;
879-
}
880-
}
881-
}
882-
}
883-
}
884-
885865
let noqa_offset = noqa_line_for.resolve(diagnostic.range.start());
886866

887867
let rule = diagnostic.kind.rule();

0 commit comments

Comments
 (0)