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:
David Peter 2024-12-12 20:49:54 +01:00 committed by GitHub
parent e5cb4d6388
commit d2712c7669
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -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,

View file

@ -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"),