diff --git a/src/gl/mod.rs b/src/gl/mod.rs index af5da08..4266169 100644 --- a/src/gl/mod.rs +++ b/src/gl/mod.rs @@ -491,20 +491,12 @@ impl Program { pub fn uniform_location(&self, name: &str) -> Option { let u = unsafe { glow_context().get_uniform_location(self.0, name) }; - if let Some(u) = u { - Some(Uniform(u)) - } else { - None - } + u.map(Uniform) } pub fn attribute_location(&self, name: &str) -> Option { let a = unsafe { glow_context().get_attrib_location(self.0, name) }; - if let Some(a) = a { - Some(Attribute(a as i32)) - } else { - None - } + a.map(|a| Attribute(a as i32)) } }