use crate::Mutation;
#[derive(Debug, Clone, Default)]
pub struct OrganizeImportsMutation {
pub deduplicate: bool,
pub merge_groups: bool,
}
impl OrganizeImportsMutation {
pub fn new() -> Self {
Self {
deduplicate: true,
merge_groups: true,
}
}
pub fn with_deduplicate(mut self, deduplicate: bool) -> Self {
self.deduplicate = deduplicate;
self
}
pub fn with_merge_groups(mut self, merge: bool) -> Self {
self.merge_groups = merge;
self
}
}
impl Mutation for OrganizeImportsMutation {
fn describe(&self) -> String {
"Organize imports: sort and group use statements".to_string()
}
fn mutation_type(&self) -> &'static str {
"OrganizeImports"
}
fn box_clone(&self) -> Box<dyn Mutation> {
Box::new(self.clone())
}
}