mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 22:31:47 +00:00
Reduce memory usage of Docstring
struct (#16183)
This commit is contained in:
parent
93aff36147
commit
61fef0a64a
15 changed files with 151 additions and 90 deletions
|
@ -1,3 +1,5 @@
|
|||
use ruff_text_size::TextSize;
|
||||
|
||||
use std::fmt;
|
||||
|
||||
/// Enumerations of the valid prefixes a string literal can have.
|
||||
|
@ -33,6 +35,13 @@ impl StringLiteralPrefix {
|
|||
Self::Raw { uppercase: false } => "r",
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn text_len(self) -> TextSize {
|
||||
match self {
|
||||
Self::Empty => TextSize::new(0),
|
||||
Self::Unicode | Self::Raw { .. } => TextSize::new(1),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for StringLiteralPrefix {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue