mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-19 01:51:30 +00:00
Use qualified_name
terminology in more structs for consistency (#4873)
This commit is contained in:
parent
33434fcb9c
commit
8938b2d555
12 changed files with 116 additions and 105 deletions
|
@ -800,7 +800,7 @@ pub fn format_import_from(level: Option<u32>, module: Option<&str>) -> String {
|
|||
/// assert_eq!(format_import_from_member(Some(1), Some("foo"), "bar"), ".foo.bar".to_string());
|
||||
/// ```
|
||||
pub fn format_import_from_member(level: Option<u32>, module: Option<&str>, member: &str) -> String {
|
||||
let mut full_name = String::with_capacity(
|
||||
let mut qualified_name = String::with_capacity(
|
||||
(level.unwrap_or(0) as usize)
|
||||
+ module.as_ref().map_or(0, |module| module.len())
|
||||
+ 1
|
||||
|
@ -808,15 +808,15 @@ pub fn format_import_from_member(level: Option<u32>, module: Option<&str>, membe
|
|||
);
|
||||
if let Some(level) = level {
|
||||
for _ in 0..level {
|
||||
full_name.push('.');
|
||||
qualified_name.push('.');
|
||||
}
|
||||
}
|
||||
if let Some(module) = module {
|
||||
full_name.push_str(module);
|
||||
full_name.push('.');
|
||||
qualified_name.push_str(module);
|
||||
qualified_name.push('.');
|
||||
}
|
||||
full_name.push_str(member);
|
||||
full_name
|
||||
qualified_name.push_str(member);
|
||||
qualified_name
|
||||
}
|
||||
|
||||
/// Create a module path from a (package, path) pair.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue