mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-23 04:55:09 +00:00
Specialize ConversionFlag (#4450)
This commit is contained in:
parent
f0465bf106
commit
4b05ca1198
8 changed files with 36 additions and 27 deletions
|
@ -5,7 +5,7 @@ use std::ops::Deref;
|
|||
|
||||
use itertools::Itertools;
|
||||
use ruff_text_size::{TextRange, TextSize};
|
||||
use rustpython_parser::ast::{Constant, Ranged};
|
||||
use rustpython_parser::ast::{Constant, ConversionFlag, Ranged};
|
||||
use rustpython_parser::{ast, Mode};
|
||||
|
||||
use ruff_python_ast::source_code::Locator;
|
||||
|
@ -410,7 +410,7 @@ pub enum ExprKind {
|
|||
},
|
||||
FormattedValue {
|
||||
value: Box<Expr>,
|
||||
conversion: usize,
|
||||
conversion: ConversionFlag,
|
||||
format_spec: Option<Box<Expr>>,
|
||||
},
|
||||
JoinedStr {
|
||||
|
@ -2038,7 +2038,7 @@ impl From<(rustpython_parser::ast::Expr, &Locator<'_>)> for Expr {
|
|||
range,
|
||||
node: ExprKind::FormattedValue {
|
||||
value: Box::new((*value, locator).into()),
|
||||
conversion: conversion.to_usize(),
|
||||
conversion,
|
||||
format_spec: format_spec.map(|f| Box::new((*f, locator).into())),
|
||||
},
|
||||
trivia: vec![],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![allow(unused_variables, clippy::too_many_arguments)]
|
||||
|
||||
use rustpython_parser::ast::Constant;
|
||||
use rustpython_parser::ast::{Constant, ConversionFlag};
|
||||
|
||||
use ruff_formatter::prelude::*;
|
||||
use ruff_formatter::{format_args, write};
|
||||
|
@ -246,7 +246,7 @@ fn format_formatted_value(
|
|||
f: &mut Formatter<ASTFormatContext>,
|
||||
expr: &Expr,
|
||||
value: &Expr,
|
||||
_conversion: usize,
|
||||
_conversion: ConversionFlag,
|
||||
format_spec: Option<&Expr>,
|
||||
) -> FormatResult<()> {
|
||||
write!(f, [text("!")])?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue