mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 14:21:53 +00:00
Rename ruff_formatter::builders::BestFitting
to FormatBestFitting
(#4841)
This commit is contained in:
parent
e7a2e0f437
commit
14e06f9f8b
3 changed files with 6 additions and 6 deletions
|
@ -2131,11 +2131,11 @@ impl<'a, 'buf, Context> FillBuilder<'a, 'buf, Context> {
|
||||||
/// The first variant is the most flat, and the last is the most expanded variant.
|
/// The first variant is the most flat, and the last is the most expanded variant.
|
||||||
/// See [`best_fitting!`] macro for a more in-detail documentation
|
/// See [`best_fitting!`] macro for a more in-detail documentation
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct BestFitting<'a, Context> {
|
pub struct FormatBestFitting<'a, Context> {
|
||||||
variants: Arguments<'a, Context>,
|
variants: Arguments<'a, Context>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Context> BestFitting<'a, Context> {
|
impl<'a, Context> FormatBestFitting<'a, Context> {
|
||||||
/// Creates a new best fitting IR with the given variants. The method itself isn't unsafe
|
/// Creates a new best fitting IR with the given variants. The method itself isn't unsafe
|
||||||
/// but it is to discourage people from using it because the printer will panic if
|
/// but it is to discourage people from using it because the printer will panic if
|
||||||
/// the slice doesn't contain at least the least and most expanded variants.
|
/// the slice doesn't contain at least the least and most expanded variants.
|
||||||
|
@ -2154,7 +2154,7 @@ impl<'a, Context> BestFitting<'a, Context> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Context> Format<Context> for BestFitting<'_, Context> {
|
impl<Context> Format<Context> for FormatBestFitting<'_, Context> {
|
||||||
fn fmt(&self, f: &mut Formatter<Context>) -> FormatResult<()> {
|
fn fmt(&self, f: &mut Formatter<Context>) -> FormatResult<()> {
|
||||||
let mut buffer = VecBuffer::new(f.state_mut());
|
let mut buffer = VecBuffer::new(f.state_mut());
|
||||||
let variants = self.variants.items();
|
let variants = self.variants.items();
|
||||||
|
|
|
@ -48,7 +48,7 @@ pub use buffer::{
|
||||||
Buffer, BufferExtensions, BufferSnapshot, Inspect, PreambleBuffer, RemoveSoftLinesBuffer,
|
Buffer, BufferExtensions, BufferSnapshot, Inspect, PreambleBuffer, RemoveSoftLinesBuffer,
|
||||||
VecBuffer,
|
VecBuffer,
|
||||||
};
|
};
|
||||||
pub use builders::BestFitting;
|
pub use builders::FormatBestFitting;
|
||||||
pub use source_code::{SourceCode, SourceCodeSlice};
|
pub use source_code::{SourceCode, SourceCodeSlice};
|
||||||
|
|
||||||
pub use crate::diagnostics::{ActualStart, FormatError, InvalidDocumentError, PrintError};
|
pub use crate::diagnostics::{ActualStart, FormatError, InvalidDocumentError, PrintError};
|
||||||
|
|
|
@ -320,7 +320,7 @@ macro_rules! format {
|
||||||
/// the content up to the first non-soft line break without exceeding the configured print width.
|
/// the content up to the first non-soft line break without exceeding the configured print width.
|
||||||
/// This definition differs from groups as that non-soft line breaks make group expand.
|
/// This definition differs from groups as that non-soft line breaks make group expand.
|
||||||
///
|
///
|
||||||
/// [crate::BestFitting] acts as a "break" boundary, meaning that it is considered to fit
|
/// [crate::FormatBestFitting] acts as a "break" boundary, meaning that it is considered to fit
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// [`Flat`]: crate::format_element::PrintMode::Flat
|
/// [`Flat`]: crate::format_element::PrintMode::Flat
|
||||||
|
@ -330,7 +330,7 @@ macro_rules! format {
|
||||||
macro_rules! best_fitting {
|
macro_rules! best_fitting {
|
||||||
($least_expanded:expr, $($tail:expr),+ $(,)?) => {{
|
($least_expanded:expr, $($tail:expr),+ $(,)?) => {{
|
||||||
unsafe {
|
unsafe {
|
||||||
$crate::BestFitting::from_arguments_unchecked($crate::format_args!($least_expanded, $($tail),+))
|
$crate::FormatBestFitting::from_arguments_unchecked($crate::format_args!($least_expanded, $($tail),+))
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue