Skip to content

Commit

Permalink
Code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser committed Sep 8, 2023
1 parent 0682684 commit f61f478
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion crates/ruff_python_formatter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ anyhow = { workspace = true }
bitflags = { workspace = true }
clap = { workspace = true }
countme = "3.0.1"
is-macro = { workspace = true }
itertools = { workspace = true }
memchr = { workspace = true }
once_cell = { workspace = true }
Expand Down
8 changes: 7 additions & 1 deletion crates/ruff_python_formatter/src/expression/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -706,14 +706,20 @@ impl CallChainLayout {
}
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, is_macro::Is)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub(crate) enum OwnParentheses {
/// The node has parentheses, but they are empty (e.g., `[]` or `f()`).
Empty,
/// The node has parentheses, and they are non-empty (e.g., `[1]` or `f(1)`).
NonEmpty,
}

impl OwnParentheses {
const fn is_non_empty(self) -> bool {
matches!(self, OwnParentheses::NonEmpty)
}
}

/// Returns the [`OwnParentheses`] value for a given [`Expr`], to indicate whether it has its
/// own parentheses or is itself parenthesized.
///
Expand Down

0 comments on commit f61f478

Please sign in to comment.