mirror of https://github.com/astral-sh/ruff
ruff_python_ast: Make `Singleton` `Copy` (#14943)
## Summary Minor changed pulled out from #14759, as it seems to make sense in isolation. ## Test Plan —
This commit is contained in:
parent
e5cb4d6388
commit
d2712c7669
|
|
@ -4061,7 +4061,7 @@ impl Ranged for Identifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
pub enum Singleton {
|
pub enum Singleton {
|
||||||
None,
|
None,
|
||||||
True,
|
True,
|
||||||
|
|
|
||||||
|
|
@ -669,7 +669,7 @@ impl<'a> Generator<'a> {
|
||||||
self.unparse_expr(value, precedence::MAX);
|
self.unparse_expr(value, precedence::MAX);
|
||||||
}
|
}
|
||||||
Pattern::MatchSingleton(ast::PatternMatchSingleton { value, range: _ }) => {
|
Pattern::MatchSingleton(ast::PatternMatchSingleton { value, range: _ }) => {
|
||||||
self.unparse_singleton(value);
|
self.unparse_singleton(*value);
|
||||||
}
|
}
|
||||||
Pattern::MatchSequence(ast::PatternMatchSequence { patterns, range: _ }) => {
|
Pattern::MatchSequence(ast::PatternMatchSequence { patterns, range: _ }) => {
|
||||||
self.p("[");
|
self.p("[");
|
||||||
|
|
@ -1211,7 +1211,7 @@ impl<'a> Generator<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn unparse_singleton(&mut self, singleton: &Singleton) {
|
pub(crate) fn unparse_singleton(&mut self, singleton: Singleton) {
|
||||||
match singleton {
|
match singleton {
|
||||||
Singleton::None => self.p("None"),
|
Singleton::None => self.p("None"),
|
||||||
Singleton::True => self.p("True"),
|
Singleton::True => self.p("True"),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue