analysis/functions: Do not import glib::translate for special functions
Special functions either do not need any translation imports at all
(ref/unref, copy/free), or their trait implementation adds imports as
appropriate.
Note that certain `copy` functions need `mut_override`, which also comes
from the translation module.
@@ -32,6 +32,8 @@ use std::{
collections::{HashMap, HashSet},
};
+use super::special_functions;
+
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Visibility {
Public,
@@ -759,7 +761,7 @@ fn analyze_function(
{
imports.add("std::boxed::Box as Box_");
}
- if !commented {
+
for transformation in &mut parameters.transformations {
if let Some(to_glib_extra) = to_glib_extras.get(&transformation.ind_c) {
transformation
@@ -772,9 +774,11 @@ fn analyze_function(
if ret.base_tid.is_some() {
imports.add("glib::object::Cast");
}
+
+ if func.name.parse::<special_functions::Type>().is_err() {
imports.add("glib::translate::*");
- bounds.update_imports(imports);
}
+ bounds.update_imports(imports);
}
let visibility = if commented {
