diff --git a/bindgen/ir/ty.rs b/bindgen/ir/ty.rs
index 6d4c5666dc..d527b1c778 100644
--- a/bindgen/ir/ty.rs
+++ b/bindgen/ir/ty.rs
@@ -248,7 +248,7 @@ impl Type {
             return Cow::Borrowed(name);
         }
 
-        let name = name.replace(|c| c == ' ' || c == ':' || c == '.', "_");
+        let name = name.replace([' ', ':', '.'], "_");
         Cow::Owned(name)
     }