Skip to content

Commit baa0703

Browse files
committed
Tidy PR (Vec -> HashSet, extra file)
1 parent f9a6563 commit baa0703

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

bindings_generator/src/api.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
use std::collections::HashMap;
1+
use std::collections::{HashMap, HashSet};
22
use serde_json;
33

44
pub struct Api {
55
pub classes: Vec<GodotClass>,
6-
pub api_underscore: Vec<String>,
6+
pub api_underscore: HashSet<String>,
77
}
88

99
impl Api {
1010
pub fn new() -> Self {
1111
let mut api = Api {
1212
classes: serde_json::from_slice(get_api_json()).expect("Failed to parse the API description"),
13-
api_underscore : Default::default(),
13+
api_underscore: Default::default(),
1414
};
1515

1616
api.strip_leading_underscores();
@@ -44,7 +44,7 @@ impl Api {
4444
for class in &mut self.classes {
4545
if class.name.starts_with('_') {
4646
class.name = class.name[1..].to_string();
47-
self.api_underscore.push(class.name.clone());
47+
self.api_underscore.insert(class.name.clone());
4848
}
4949
for method in &mut class.methods {
5050
if method.return_type.starts_with('_') {

bindings_generator/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ fn generate_class_bindings(
167167

168168
// methods and method table
169169
{
170-
let has_underscore = api.api_underscore.iter().any(|name| class.name.starts_with(name));
170+
let has_underscore = api.api_underscore.contains(&class.name);
171171
generate_method_table(output_method_table, class, has_underscore)?;
172172

173173
for method in &class.methods {

core/src/generated.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)