Skip to content

Commit 46514c7

Browse files
bors[bot]toasteater
andauthored
Merge #703
703: Fix current and future clippy lints r=toasteater a=toasteater This fixes new clippy lints in current stable and nightly. bors r+ Co-authored-by: toasteater <48371905+toasteater@users.noreply.github.com>
2 parents 4bc7681 + 6e41d9c commit 46514c7

File tree

19 files changed

+49
-44
lines changed

19 files changed

+49
-44
lines changed

bindings_generator/src/class_docs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ use std::{collections::HashMap, fs};
33
use roxmltree::Node;
44

55
#[derive(Debug)]
6-
pub struct GodotXMLDocs {
6+
pub struct GodotXmlDocs {
77
class_fn_desc: HashMap<(String, String), String>,
88
}
99

10-
impl GodotXMLDocs {
10+
impl GodotXmlDocs {
1111
pub fn new(folder: &str) -> Self {
1212
let entries = fs::read_dir(folder)
1313
.unwrap()
1414
.map(|e| e.unwrap().path())
1515
.collect::<Vec<_>>();
1616

17-
let mut docs = GodotXMLDocs {
17+
let mut docs = GodotXmlDocs {
1818
class_fn_desc: HashMap::default(),
1919
};
2020

bindings_generator/src/classes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::api::*;
2-
use crate::class_docs::GodotXMLDocs;
2+
use crate::class_docs::GodotXmlDocs;
33
use crate::methods;
44
use crate::special_methods;
55

@@ -24,7 +24,7 @@ pub(crate) fn generate_class_struct(class: &GodotClass) -> TokenStream {
2424
pub(crate) fn generate_class_impl(
2525
class: &GodotClass,
2626
icalls: &mut HashMap<String, methods::MethodSig>,
27-
docs: Option<&GodotXMLDocs>,
27+
docs: Option<&GodotXmlDocs>,
2828
) -> TokenStream {
2929
let class_singleton = if class.singleton {
3030
special_methods::generate_singleton_getter(class)

bindings_generator/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub struct BindingResult {
4343
pub icalls: TokenStream,
4444
}
4545

46-
pub fn generate_bindings(api: &Api, docs: Option<&GodotXMLDocs>) -> BindingResult {
46+
pub fn generate_bindings(api: &Api, docs: Option<&GodotXmlDocs>) -> BindingResult {
4747
let mut icalls = HashMap::new();
4848

4949
let class_bindings = api
@@ -80,7 +80,7 @@ fn generate_class_bindings(
8080
api: &Api,
8181
class: &GodotClass,
8282
icalls: &mut HashMap<String, MethodSig>,
83-
docs: Option<&GodotXMLDocs>,
83+
docs: Option<&GodotXmlDocs>,
8484
) -> TokenStream {
8585
// types and methods
8686
let types_and_methods = {

bindings_generator/src/methods.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::api::*;
2-
use crate::class_docs::GodotXMLDocs;
2+
use crate::class_docs::GodotXmlDocs;
33
use crate::rust_safe_name;
44

55
use proc_macro2::TokenStream;
@@ -250,7 +250,7 @@ fn rename_property_getter<'a>(name: &'a str, class: &GodotClass) -> &'a str {
250250
if name.starts_with("get_") && class.is_getter(name) {
251251
&name[4..]
252252
} else {
253-
&name[..]
253+
&name
254254
}
255255
}
256256

@@ -263,7 +263,7 @@ const UNSAFE_OBJECT_METHODS: &[(&str, &str)] = &[
263263
pub(crate) fn generate_methods(
264264
class: &GodotClass,
265265
icalls: &mut HashMap<String, MethodSig>,
266-
docs: Option<&GodotXMLDocs>,
266+
docs: Option<&GodotXmlDocs>,
267267
) -> TokenStream {
268268
// Brings values of some types to a type with less information.
269269
fn arg_erase(ty: &Ty, name: &proc_macro2::Ident) -> TokenStream {

examples/dodge_the_creeps/HUD.gdns renamed to examples/dodge_the_creeps/Hud.gdns

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
[ext_resource path="res://dodge_the_creeps_library.gdnlib" type="GDNativeLibrary" id=1]
44

55
[resource]
6-
resource_name = "HUD"
7-
class_name = "HUD"
6+
resource_name = "Hud"
7+
class_name = "Hud"
88
library = ExtResource( 1 )

examples/dodge_the_creeps/HUD.tscn renamed to examples/dodge_the_creeps/Hud.tscn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[gd_scene load_steps=6 format=2]
22

3-
[ext_resource path="res://HUD.gdns" type="Script" id=1]
3+
[ext_resource path="res://Hud.gdns" type="Script" id=1]
44
[ext_resource path="res://fonts/Xolonium-Regular.ttf" type="DynamicFontData" id=2]
55

66
[sub_resource type="DynamicFont" id=1]

examples/dodge_the_creeps/Main.tscn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[ext_resource path="res://Main.gdns" type="Script" id=1]
44
[ext_resource path="res://Mob.tscn" type="PackedScene" id=2]
55
[ext_resource path="res://Player.tscn" type="PackedScene" id=3]
6-
[ext_resource path="res://HUD.tscn" type="PackedScene" id=4]
6+
[ext_resource path="res://Hud.tscn" type="PackedScene" id=4]
77

88
[sub_resource type="Curve2D" id=1]
99
_data = {

examples/dodge_the_creeps/src/hud.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ use gdnative::prelude::*;
22

33
#[derive(NativeClass)]
44
#[inherit(CanvasLayer)]
5-
#[user_data(user_data::ArcData<HUD>)]
5+
#[user_data(user_data::ArcData<Hud>)]
66
#[register_with(Self::register_hud)]
7-
pub struct HUD;
7+
pub struct Hud;
88

99
#[methods]
10-
impl HUD {
10+
impl Hud {
1111
fn register_hud(builder: &ClassBuilder<Self>) {
1212
builder.add_signal(Signal {
1313
name: "start_game",
@@ -16,7 +16,7 @@ impl HUD {
1616
}
1717

1818
fn new(_owner: &CanvasLayer) -> Self {
19-
HUD
19+
Hud
2020
}
2121

2222
#[export]

examples/dodge_the_creeps/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn init(handle: InitHandle) {
99
handle.add_class::<player::Player>();
1010
handle.add_class::<mob::Mob>();
1111
handle.add_class::<main_scene::Main>();
12-
handle.add_class::<hud::HUD>();
12+
handle.add_class::<hud::Hud>();
1313
}
1414

1515
godot_init!(init);

examples/dodge_the_creeps/src/main_scene.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl Main {
3232
score_timer.stop();
3333
mob_timer.stop();
3434

35-
let hud = unsafe { owner.get_node_as_instance::<hud::HUD>("hud").unwrap() };
35+
let hud = unsafe { owner.get_node_as_instance::<hud::Hud>("hud").unwrap() };
3636
hud.map(|x, o| x.show_game_over(&*o))
3737
.ok()
3838
.unwrap_or_else(|| godot_print!("Unable to get hud"));
@@ -57,7 +57,7 @@ impl Main {
5757

5858
start_timer.start(0.0);
5959

60-
let hud = unsafe { owner.get_node_as_instance::<hud::HUD>("hud").unwrap() };
60+
let hud = unsafe { owner.get_node_as_instance::<hud::Hud>("hud").unwrap() };
6161
hud.map(|x, o| {
6262
x.update_score(&*o, self.score);
6363
x.show_message(&*o, "Get Ready".into());
@@ -78,7 +78,7 @@ impl Main {
7878
fn on_score_timer_timeout(&mut self, owner: &Node) {
7979
self.score += 1;
8080

81-
let hud = unsafe { owner.get_node_as_instance::<hud::HUD>("hud").unwrap() };
81+
let hud = unsafe { owner.get_node_as_instance::<hud::Hud>("hud").unwrap() };
8282
hud.map(|x, o| x.update_score(&*o, self.score))
8383
.ok()
8484
.unwrap_or_else(|| godot_print!("Unable to get hud"));
@@ -119,7 +119,7 @@ impl Main {
119119
mob_owner
120120
.set_linear_velocity(mob_owner.linear_velocity().rotated(Angle { radians: d }));
121121

122-
let hud = unsafe { owner.get_node_as_instance::<hud::HUD>("hud").unwrap() };
122+
let hud = unsafe { owner.get_node_as_instance::<hud::Hud>("hud").unwrap() };
123123

124124
hud.map(|_, o| {
125125
o.connect(

0 commit comments

Comments
 (0)