diff --git a/src/examples/triangle.rs b/src/examples/triangle.rs index d455b468..8b9da177 100644 --- a/src/examples/triangle.rs +++ b/src/examples/triangle.rs @@ -24,7 +24,6 @@ use glfw::Context; use std::cast; use std::mem; use std::ptr; -use std::slice; use std::str; // Vertex data @@ -69,9 +68,9 @@ fn compile_shader(src: &str, ty: GLenum) -> GLuint { if status != (gl::TRUE as GLint) { let mut len = 0; gl::GetShaderiv(shader, gl::INFO_LOG_LENGTH, &mut len); - let mut buf = slice::from_elem(len as uint - 1, 0u8); // subtract 1 to skip the trailing null character + let mut buf = Vec::from_elem(len as uint - 1, 0u8); // subtract 1 to skip the trailing null character gl::GetShaderInfoLog(shader, len, ptr::mut_null(), buf.as_mut_ptr() as *mut GLchar); - fail!(str::from_utf8_owned(buf).expect("ShaderInfoLog not valid utf8")); + fail!("{}", str::from_utf8(buf.as_slice()).expect("ShaderInfoLog not valid utf8")); } } shader @@ -91,9 +90,9 @@ fn link_program(vs: GLuint, fs: GLuint) -> GLuint { if status != (gl::TRUE as GLint) { let mut len: GLint = 0; gl::GetProgramiv(program, gl::INFO_LOG_LENGTH, &mut len); - let mut buf = slice::from_elem(len as uint - 1, 0u8); // subtract 1 to skip the trailing null character + let mut buf = Vec::from_elem(len as uint - 1, 0u8); // subtract 1 to skip the trailing null character gl::GetProgramInfoLog(program, len, ptr::mut_null(), buf.as_mut_ptr() as *mut GLchar); - fail!(str::from_utf8_owned(buf).expect("ProgramInfoLog not valid utf8")); + fail!("{}", str::from_utf8(buf.as_slice()).expect("ProgramInfoLog not valid utf8")); } } program diff --git a/src/gen/main.rs b/src/gen/main.rs index 6c65702b..bce21577 100644 --- a/src/gen/main.rs +++ b/src/gen/main.rs @@ -69,7 +69,7 @@ fn main() { return; } - let ns = match args.opt_str("namespace").unwrap_or(~"gl").as_slice() { + let ns = match args.opt_str("namespace").unwrap_or("gl".to_owned()).as_slice() { "gl" => Gl, "glx" => fail!("glx generation unimplemented"), "wgl" => fail!("wgl generation unimplemented"), @@ -85,9 +85,9 @@ fn main() { } else { Some(Filter { extensions: args.opt_strs("extension"), - profile: args.opt_str("profile").unwrap_or(~"core"), - version: args.opt_str("version").unwrap_or(~"4.3"), - api: args.opt_str("api").unwrap_or(~"gl"), + profile: args.opt_str("profile").unwrap_or("core".to_owned()), + version: args.opt_str("version").unwrap_or("4.3".to_owned()), + api: args.opt_str("api").unwrap_or("gl".to_owned()), }) }; @@ -115,13 +115,13 @@ fn gen_binding_ident(binding: &Binding, use_idents: bool) -> ~str { // fixed if use_idents { match binding.ident.as_slice() { - "in" => ~"in_", - "ref" => ~"ref_", - "type" => ~"type_", + "in" => "in_".to_owned(), + "ref" => "ref_".to_owned(), + "type" => "type_".to_owned(), ident => ident.to_owned(), } } else { - ~"_" + "_".to_owned() } } diff --git a/src/gen/registry.rs b/src/gen/registry.rs index 3b6774fe..550456a5 100644 --- a/src/gen/registry.rs +++ b/src/gen/registry.rs @@ -314,8 +314,8 @@ impl<'a> RegistryBuilder { match self.recv() { // ignores Characters(_) | Comment(_) => (), - StartElement(ref s, _) if s.as_slice() == "comment" => self.skip_until(EndElement(~"comment")), - StartElement(ref s, _) if s.as_slice() == "types" => self.skip_until(EndElement(~"types")), + StartElement(ref s, _) if s.as_slice() == "comment" => self.skip_until(EndElement("comment".to_owned())), + StartElement(ref s, _) if s.as_slice() == "types" => self.skip_until(EndElement("types".to_owned())), // add groups StartElement(ref s, _) if s.as_slice() == "groups" => { @@ -428,8 +428,8 @@ impl<'a> RegistryBuilder { Registry { groups: groups, - enums: enums.move_iter().filter(|e| desired_enums.contains(&(~"GL_" + e.ident))).collect::>(), - cmds: cmds.move_iter().filter(|c| desired_cmds.contains(&(~"gl" + c.proto.ident))).collect::>(), + enums: enums.move_iter().filter(|e| desired_enums.contains(&("GL_".to_owned() + e.ident))).collect::>(), + cmds: cmds.move_iter().filter(|c| desired_cmds.contains(&("gl".to_owned() + c.proto.ident))).collect::>(), // these aren't important after this step features: Vec::new(), extensions: Vec::new(), @@ -512,7 +512,7 @@ impl<'a> RegistryBuilder { match self.recv() { // ignores Characters(_) | Comment(_) => (), - StartElement(ref s, _) if s.as_slice() == "unused" => self.skip_until(EndElement(~"unused")), + StartElement(ref s, _) if s.as_slice() == "unused" => self.skip_until(EndElement("unused".to_owned())), // add enum definition StartElement(ref s, ref atts) if s.as_slice() == "enum" => { diff --git a/src/gen/ty.rs b/src/gen/ty.rs index e946febe..6ffb8b86 100644 --- a/src/gen/ty.rs +++ b/src/gen/ty.rs @@ -15,7 +15,7 @@ pub fn to_return_suffix(ty: &str) -> ~str { match ty { - "c_void" | "VOID" | "GLvoid" => ~"", + "c_void" | "VOID" | "GLvoid" => "".to_owned(), ty_str => " -> " + ty_str.replace("*mut ", "*"), } }