Skip to content

Commit a3eaacf

Browse files
committed
Appease clippy
1 parent b5b558e commit a3eaacf

File tree

6 files changed

+16
-7
lines changed

6 files changed

+16
-7
lines changed

examples/dodge-the-creeps/src/player.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ impl Player {
8282
let change = velocity * delta;
8383
let position = owner.global_position() + change;
8484
let position = Vector2::new(
85-
position.x.max(0.0).min(self.screen_size.x),
86-
position.y.max(0.0).min(self.screen_size.y),
85+
position.x.clamp(0.0, self.screen_size.x),
86+
position.y.clamp(0.0, self.screen_size.y),
8787
);
8888
owner.set_global_position(position);
8989
}

examples/scene-create/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl SceneCreate {
5959
Ok(spatial) => {
6060
// Here is how you rename the child...
6161
let key_str = format!("child_{}", self.children_spawned);
62-
spatial.set_name(&key_str);
62+
spatial.set_name(key_str);
6363

6464
let x = (self.children_spawned % 10) as f32;
6565
let z = (self.children_spawned / 10) as f32;

gdnative-core/src/core_types/geom/transform.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ impl Transform {
103103
This method will be renamed to translated_local in gdnative 0.12."]
104104
#[inline]
105105
pub fn translated(&self, translation: Vector3) -> Self {
106+
self.translated_local(translation)
107+
}
108+
109+
/// Returns this transform, with its origin moved by a certain `translation`
110+
#[inline]
111+
pub fn translated_local(&self, translation: Vector3) -> Self {
106112
Self {
107113
basis: self.basis,
108114
origin: self.origin + translation,
@@ -365,7 +371,7 @@ mod tests {
365371
#[test]
366372
fn translation_is_sane() {
367373
let translation = Vector3::new(1.0, 2.0, 3.0);
368-
let t = Transform::default().translated(translation);
374+
let t = Transform::default().translated_local(translation);
369375
assert!(t.basis.elements[0] == Vector3::new(1.0, 0.0, 0.0));
370376
assert!(t.basis.elements[1] == Vector3::new(0.0, 1.0, 0.0));
371377
assert!(t.basis.elements[2] == Vector3::new(0.0, 0.0, 1.0));

gdnative-core/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
clippy::missing_safety_doc,
2626
clippy::non_send_fields_in_send_ty
2727
)]
28-
#![cfg_attr(feature = "gd-test", allow(clippy::blacklisted_name))]
28+
#![cfg_attr(
29+
any(test, feature = "gd-test"),
30+
allow(clippy::excessive_precision, clippy::disallowed_names)
31+
)]
2932

3033
#[doc(hidden)]
3134
pub extern crate gdnative_sys as sys;

test/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(clippy::blacklisted_name)]
1+
#![allow(clippy::disallowed_names)]
22
#![allow(deprecated)]
33

44
use gdnative::prelude::*;

test/src/test_async.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub(crate) fn run_tests() -> bool {
99

1010
thread_local! {
1111
static EXECUTOR: &'static SharedLocalPool = {
12-
Box::leak(Box::new(SharedLocalPool::default()))
12+
Box::leak(Box::default())
1313
};
1414
}
1515

0 commit comments

Comments
 (0)