Skip to content

Commit b984183

Browse files
committed
Appease clippy
1 parent a73c7ed commit b984183

File tree

14 files changed

+25
-16
lines changed

14 files changed

+25
-16
lines changed

gdnative-core/src/core_types/byte_array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ godot_test!(
1414
let original_read = {
1515
let read = arr.read();
1616
assert_eq!(&[0, 1, 2, 3, 4, 5, 6, 7], read.as_slice());
17-
read.clone()
17+
read
1818
};
1919

2020
let mut cow_arr = arr.new_ref();

gdnative-core/src/core_types/color_array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ godot_test!(
2323
Color::from_rgb(0.0, 1.0, 0.0),
2424
Color::from_rgb(0.0, 0.0, 1.0),
2525
], read.as_slice());
26-
read.clone()
26+
read
2727
};
2828

2929
let mut cow_arr = arr.new_ref();

gdnative-core/src/core_types/error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::sys;
22

33
/// Error codes used in various Godot APIs.
4+
#[allow(clippy::unnecessary_cast)] // False positives: casts necessary for cross-platform
45
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
56
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
67
#[repr(u32)]
@@ -65,6 +66,7 @@ impl GodotError {
6566
/// `err` should be a valid value for `GodotError`.
6667
#[inline]
6768
#[doc(hidden)]
69+
#[allow(clippy::unnecessary_cast)] // False positives: casts necessary for cross-platform
6870
pub unsafe fn result_from_sys(err: sys::godot_error) -> Result<(), Self> {
6971
if err == sys::godot_error_GODOT_OK {
7072
return Ok(());

gdnative-core/src/core_types/float32_array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ godot_test!(
1616
for (n, i) in read.as_slice().iter().enumerate() {
1717
assert_relative_eq!(n as f32, i);
1818
}
19-
read.clone()
19+
read
2020
};
2121

2222
let mut cow_arr = arr.new_ref();
@@ -30,7 +30,7 @@ godot_test!(
3030
}
3131

3232
for i in 0..8 {
33-
assert_relative_eq!(i as f32 * 2., cow_arr.get(i as i32));
33+
assert_relative_eq!(i as f32 * 2., cow_arr.get(i));
3434
}
3535

3636
// the write shouldn't have affected the original array

gdnative-core/src/core_types/int32_array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ godot_test!(
1414
let original_read = {
1515
let read = arr.read();
1616
assert_eq!(&[0, 1, 2, 3, 4, 5, 6, 7], read.as_slice());
17-
read.clone()
17+
read
1818
};
1919

2020
let mut cow_arr = arr.new_ref();
@@ -28,7 +28,7 @@ godot_test!(
2828
}
2929

3030
for i in 0..8 {
31-
assert_eq!(i * 2, cow_arr.get(i as i32));
31+
assert_eq!(i * 2, cow_arr.get(i));
3232
}
3333

3434
// the write shouldn't have affected the original array

gdnative-core/src/core_types/string_array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ godot_test!(
2323
GodotString::from("bar"),
2424
GodotString::from("baz"),
2525
], read.as_slice());
26-
read.clone()
26+
read
2727
};
2828

2929
let mut cow_arr = arr.new_ref();

gdnative-core/src/core_types/variant.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ decl_variant_type!(
166166
);
167167

168168
impl VariantType {
169+
#[allow(clippy::unnecessary_cast)] // False positives: casts necessary for cross-platform
169170
#[doc(hidden)]
170171
#[inline]
171172
pub fn from_sys(v: sys::godot_variant_type) -> VariantType {
@@ -182,6 +183,7 @@ impl VariantType {
182183
}
183184
}
184185

186+
#[allow(clippy::unnecessary_cast)] // False positives: casts necessary for cross-platform
185187
#[repr(u32)]
186188
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
187189
pub enum CallError {
@@ -198,6 +200,7 @@ pub enum CallError {
198200
}
199201

200202
impl CallError {
203+
#[allow(clippy::unnecessary_cast)] // False positives: casts necessary for cross-platform
201204
#[inline]
202205
fn from_sys(v: sys::godot_variant_call_error_error) -> Result<(), CallError> {
203206
if v == sys::godot_variant_call_error_error_GODOT_CALL_ERROR_CALL_OK {
@@ -230,6 +233,7 @@ impl std::fmt::Display for CallError {
230233
impl std::error::Error for CallError {}
231234

232235
/// Godot variant operator kind.
236+
#[allow(clippy::unnecessary_cast)] // False positives: casts necessary for cross-platform
233237
#[repr(u32)]
234238
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
235239
pub enum VariantOperator {
@@ -269,6 +273,7 @@ pub enum VariantOperator {
269273
In = sys::godot_variant_operator_GODOT_VARIANT_OP_IN as u32,
270274
}
271275

276+
#[allow(clippy::unnecessary_cast)] // False positives: casts necessary for cross-platform
272277
impl VariantOperator {
273278
const MAX: u32 = sys::godot_variant_operator_GODOT_VARIANT_OP_MAX as u32;
274279

gdnative-core/src/core_types/vector2_array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ godot_test!(
2323
Vector2::new(3.0, 4.0),
2424
Vector2::new(5.0, 6.0),
2525
], read.as_slice());
26-
read.clone()
26+
read
2727
};
2828

2929
let mut cow_arr = arr.new_ref();

gdnative-core/src/core_types/vector3.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub struct Vector3 {
1515
pub z: f32,
1616
}
1717

18+
#[allow(clippy::unnecessary_cast)] // False positives: casts necessary for cross-platform
1819
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
1920
#[repr(u32)]
2021
pub enum Axis {

gdnative-core/src/core_types/vector3_array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ godot_test!(
2323
Vector3::new(3.0, 4.0, 5.0),
2424
Vector3::new(5.0, 6.0, 7.0),
2525
], read.as_slice());
26-
read.clone()
26+
read
2727
};
2828

2929
let mut cow_arr = arr.new_ref();

0 commit comments

Comments
 (0)