mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 22:31:47 +00:00
Support fmt: skip
for simple-statements and decorators (#6561)
This commit is contained in:
parent
e3ecbe660e
commit
4dc32a00d0
40 changed files with 545 additions and 316 deletions
|
@ -215,6 +215,18 @@ pub(crate) enum SuppressionKind {
|
|||
Skip,
|
||||
}
|
||||
|
||||
impl SuppressionKind {
|
||||
pub(crate) fn has_skip_comment(trailing_comments: &[SourceComment], source: &str) -> bool {
|
||||
trailing_comments.iter().any(|comment| {
|
||||
comment.line_position().is_end_of_line()
|
||||
&& matches!(
|
||||
comment.suppression_kind(source),
|
||||
Some(SuppressionKind::Skip | SuppressionKind::Off)
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Ranged for SourceComment {
|
||||
#[inline]
|
||||
fn range(&self) -> TextRange {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue