Skip to content

Commit 8559e1e

Browse files
committed
Force inlining format args via clippy::uninlined_format_args
1 parent 150b58e commit 8559e1e

File tree

15 files changed

+47
-20
lines changed

15 files changed

+47
-20
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ members = [
1010
"tests/test_with_extensions",
1111
"khronos_api",
1212
]
13+
14+
[workspace.lints.clippy]
15+
uninlined_format_args = "deny"

gl/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ gl_generator = { version = "0.14.0", path = "../gl_generator" }
2121

2222
[dev-dependencies]
2323
glutin = "0.24"
24+
25+
[lints]
26+
workspace = true

gl_generator/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ unstable_generator_utils = []
2626
khronos_api = { version = "3.1.0", path = "../khronos_api" }
2727
log = "0.4"
2828
xml-rs = "0.8"
29+
30+
[lints]
31+
workspace = true

gl_generator/generators/debug_struct_gen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ where
246246
.map(|(name, ty)| if ty.contains("GLDEBUGPROC") {
247247
", \"<callback>\"".to_string()
248248
} else {
249-
format!(", {}", name)
249+
format!(", {name}")
250250
})
251251
.collect::<Vec<_>>()
252252
.concat()

gl_generator/generators/global_gen.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,7 @@ where
247247
}}
248248
}}
249249
}}
250-
"##,
251-
fnname = fnname,
252-
fallbacks = fallbacks,
253-
symbol = symbol
250+
"##
254251
)?;
255252
}
256253

gl_generator/generators/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ pub fn gen_parameters(cmd: &Cmd, with_idents: bool, with_types: bool) -> Vec<Str
111111
/// Example results: `"glClear"`, `"wglCreateContext"`, etc.
112112
pub fn gen_symbol_name(api: Api, cmd: &str) -> String {
113113
match api {
114-
Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 | Api::Glsc2 => format!("gl{}", cmd),
115-
Api::Glx => format!("glX{}", cmd),
116-
Api::Wgl => format!("wgl{}", cmd),
117-
Api::Egl => format!("egl{}", cmd),
114+
Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 | Api::Glsc2 => format!("gl{cmd}"),
115+
Api::Glx => format!("glX{cmd}"),
116+
Api::Wgl => format!("wgl{cmd}"),
117+
Api::Egl => format!("egl{cmd}"),
118118
}
119119
}

gl_generator/registry/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl Registry {
143143
api,
144144
fallbacks,
145145
extensions,
146-
version: format!("{}.{}", major, minor),
146+
version: format!("{major}.{minor}"),
147147
profile,
148148
};
149149

gl_generator/registry/parse.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ fn profile_from_str(src: &str) -> Result<Profile, ()> {
111111

112112
fn underscore_numeric_prefix(src: &str) -> String {
113113
match src.chars().next() {
114-
Some(c) if c.is_numeric() => format!("_{}", src),
114+
Some(c) if c.is_numeric() => format!("_{src}"),
115115
Some(_) | None => src.to_string(),
116116
}
117117
}
@@ -323,7 +323,7 @@ trait Parse: Sized + Iterator<Item = ParseEvent> {
323323
},
324324

325325
ParseEvent::Start(ref name, ref attributes) if name == "feature" => {
326-
debug!("Parsing feature: {:?}", attributes);
326+
debug!("Parsing feature: {attributes:?}");
327327
features.push(Feature::convert(&mut self, attributes));
328328
},
329329

@@ -361,11 +361,11 @@ trait Parse: Sized + Iterator<Item = ParseEvent> {
361361
for remove in &feature.removes {
362362
if remove.profile == filter.profile {
363363
for enm in &remove.enums {
364-
debug!("Removing {}", enm);
364+
debug!("Removing {enm}");
365365
desired_enums.remove(enm);
366366
}
367367
for cmd in &remove.commands {
368-
debug!("Removing {}", cmd);
368+
debug!("Removing {cmd}");
369369
desired_cmds.remove(cmd);
370370
}
371371
}
@@ -464,16 +464,16 @@ trait Parse: Sized + Iterator<Item = ParseEvent> {
464464
two: &'a str,
465465
end: &'a str,
466466
) -> (Vec<T>, Vec<U>) {
467-
debug!("consume_two: looking for {} and {} until {}", one, two, end);
467+
debug!("consume_two: looking for {one} and {two} until {end}");
468468

469469
let mut ones = Vec::new();
470470
let mut twos = Vec::new();
471471

472472
loop {
473473
match self.next().unwrap() {
474474
ParseEvent::Start(ref name, ref attributes) => {
475-
debug!("Found start element <{:?} {:?}>", name, attributes);
476-
debug!("one and two are {} and {}", one, two);
475+
debug!("Found start element <{name:?} {attributes:?}>");
476+
debug!("one and two are {one} and {two}");
477477

478478
let n = name.clone();
479479

@@ -492,7 +492,7 @@ trait Parse: Sized + Iterator<Item = ParseEvent> {
492492
}
493493
},
494494
ParseEvent::End(ref name) => {
495-
debug!("Found end element </{:?}>", name);
495+
debug!("Found end element </{name:?}>");
496496

497497
if one == name || two == name {
498498
continue;
@@ -736,7 +736,7 @@ impl FromXml for Feature {
736736
let name = get_attribute(a, "name").unwrap();
737737
let number = get_attribute(a, "number").unwrap();
738738

739-
debug!("Found api = {}, name = {}, number = {}", api, name, number);
739+
debug!("Found api = {api}, name = {name}, number = {number}");
740740

741741
let (require, remove) = parser.consume_two("require", "remove", "feature");
742742

khronos_api/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repository = "https://github.com/brendanzab/gl-rs/"
1515
readme = "README.md"
1616

1717
# Only include what we need here. The git submodules are quite large, and would
18-
# exceed the maximimum crate size if we didn't do this
18+
# exceed the maximum crate size if we didn't do this
1919
include = [
2020
"/README.md",
2121
"/src/**/*",
@@ -30,3 +30,6 @@ include = [
3030

3131
categories = ["rendering::graphics-api"]
3232
keywords = ["gl", "egl", "opengl", "khronos"]
33+
34+
[lints]
35+
workspace = true

tests/test_add_registries/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ path = "lib.rs"
99

1010
[build-dependencies]
1111
gl_generator = { path = "../../gl_generator" }
12+
13+
[lints]
14+
workspace = true

0 commit comments

Comments
 (0)