Leading, Dangling, and Trailing comments formatting (#4785)

This commit is contained in:
Micha Reiser 2023-06-02 09:26:36 +02:00 committed by GitHub
parent b2498c576f
commit 5d939222db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 824 additions and 771 deletions

View file

@ -1,4 +1,4 @@
use ruff_text_size::TextRange;
use ruff_text_size::{TextRange, TextSize};
use std::fmt::{Debug, Formatter};
/// The source code of a document that gets formatted
@ -68,9 +68,17 @@ impl SourceCodeSlice {
&code.text[self.range]
}
pub fn range(&self) -> TextRange {
pub const fn range(&self) -> TextRange {
self.range
}
pub const fn start(&self) -> TextSize {
self.range.start()
}
pub const fn end(&self) -> TextSize {
self.range.end()
}
}
impl Debug for SourceCodeSlice {