Change all &Option<> to Option<&> (#768)

This commit is contained in:
Charlie Marsh 2022-11-16 09:40:01 -05:00 committed by GitHub
parent 910ee523dd
commit 7d8360a1de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 81 additions and 59 deletions

View file

@ -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
}