use hir::{AsAssocItem, HasVisibility, ModuleDef, Visibility};
use ide_db::assists::{AssistId, AssistKind};
+use itertools::Itertools;
use stdx::to_lower_snake_case;
use syntax::{
ast::{self, edit::IndentLevel, HasDocComments, HasName},
},
_ => "_".to_string(),
});
- intersperse_string(args_iter, ", ")
+ Itertools::intersperse(args_iter, ", ".to_string()).collect()
}
/// Helper function to build a function call. `None` if expected `self_name` was not provided
}
}
-/// Helper function to concatenate string with a separator between them
-fn intersperse_string(mut iter: impl Iterator<Item = String>, separator: &str) -> String {
- let mut result = String::new();
- if let Some(first) = iter.next() {
- result.push_str(&first);
- }
- for string in iter {
- result.push_str(separator);
- result.push_str(&string);
- }
- result
-}
-
#[cfg(test)]
mod tests {
use crate::tests::{check_assist, check_assist_not_applicable};