Skip to content

Commit ffb7fd1

Browse files
committed
comments
1 parent ed8e5ed commit ffb7fd1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

crates/ruff_linter/src/fix/codemods.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ pub(crate) fn retain_imports(
170170
Ok(tree.codegen_stylist(stylist))
171171
}
172172

173+
/// Create an NFKC-normalized qualified name from a libCST node.
173174
fn qualified_name_from_name_or_attribute(module: &NameOrAttribute) -> String {
174175
fn collect_segments<'a>(expr: &'a Expression, parts: &mut SmallVec<[&'a str; 8]>) {
175176
match expr {
@@ -187,6 +188,14 @@ fn qualified_name_from_name_or_attribute(module: &NameOrAttribute) -> String {
187188
}
188189
}
189190

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.
190199
fn unqualified_name_from_expression<'a>(
191200
expr: &'a Expression<'a>,
192201
) -> Option<UnqualifiedName<'a>> {

0 commit comments

Comments
 (0)