mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 14:21:53 +00:00
Change all &Option<> to Option<&> (#768)
This commit is contained in:
parent
910ee523dd
commit
7d8360a1de
15 changed files with 81 additions and 59 deletions
|
@ -226,13 +226,15 @@ pub fn is_super_call_with_arguments(func: &Expr, args: &[Expr]) -> bool {
|
|||
}
|
||||
|
||||
/// Format the module name for a relative import.
|
||||
pub fn format_import_from(level: &Option<usize>, module: &Option<String>) -> String {
|
||||
pub fn format_import_from(level: Option<&usize>, module: Option<&String>) -> String {
|
||||
let mut module_name = String::with_capacity(16);
|
||||
for _ in 0..level.unwrap_or_default() {
|
||||
module_name.push('.');
|
||||
if let Some(level) = level {
|
||||
for _ in 0..*level {
|
||||
module_name.push('.');
|
||||
}
|
||||
}
|
||||
if let Some(m) = module {
|
||||
module_name.push_str(m);
|
||||
if let Some(module) = module {
|
||||
module_name.push_str(module);
|
||||
}
|
||||
module_name
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue