MCPcopy Index your code
hub / github.com/RustPython/RustPython / ruff_fstring_element_into_iter

Function ruff_fstring_element_into_iter

crates/vm/src/stdlib/_ast/string.rs:6–19  ·  view source on GitHub ↗
(
    mut fstring_element: ast::InterpolatedStringElements,
)

Source from the content-addressed store, hash-verified

4use ast::str_prefix::StringLiteralPrefix;
5
6fn ruff_fstring_element_into_iter(
7 mut fstring_element: ast::InterpolatedStringElements,
8) -> impl Iterator<Item = ast::InterpolatedStringElement> {
9 let default = ast::InterpolatedStringElement::Literal(ast::InterpolatedStringLiteralElement {
10 node_index: Default::default(),
11 range: Default::default(),
12 value: Default::default(),
13 });
14 fstring_element
15 .iter_mut()
16 .map(move |elem| core::mem::replace(elem, default.clone()))
17 .collect::<Vec<_>>()
18 .into_iter()
19}
20
21fn ruff_fstring_element_to_joined_str_part(
22 element: ast::InterpolatedStringElement,

Callers 3

fstring_to_objectFunction · 0.85
tstring_to_objectFunction · 0.85

Calls 6

LiteralClass · 0.50
replaceFunction · 0.50
into_iterMethod · 0.45
mapMethod · 0.45
iter_mutMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected