File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
crates/ruff_linter/src/fix Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,7 @@ pub(crate) fn retain_imports(
170
170
Ok ( tree. codegen_stylist ( stylist) )
171
171
}
172
172
173
+ /// Create an NFKC-normalized qualified name from a libCST node.
173
174
fn qualified_name_from_name_or_attribute ( module : & NameOrAttribute ) -> String {
174
175
fn collect_segments < ' a > ( expr : & ' a Expression , parts : & mut SmallVec < [ & ' a str ; 8 ] > ) {
175
176
match expr {
@@ -187,6 +188,14 @@ fn qualified_name_from_name_or_attribute(module: &NameOrAttribute) -> String {
187
188
}
188
189
}
189
190
191
+ /// Attempt to create an [`UnqualifiedName`] from a libCST expression.
192
+ ///
193
+ /// Strictly speaking, the `UnqualifiedName` returned by this function may be invalid,
194
+ /// since it hasn't been NFKC-normalized. In order for an `UnqualifiedName` to be
195
+ /// comparable to one constructed from a `ruff_python_ast` node, it has to undergo
196
+ /// NFKC normalization. As a local function, however, this is fine;
197
+ /// the outer function always performs NFKC normalization before returning the
198
+ /// qualified name to the caller.
190
199
fn unqualified_name_from_expression < ' a > (
191
200
expr : & ' a Expression < ' a > ,
192
201
) -> Option < UnqualifiedName < ' a > > {
You can’t perform that action at this time.
0 commit comments