Skip to content

Commit

Permalink
Clippy nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
Bromeon committed Oct 12, 2022
1 parent ea43b63 commit 2d5bf2e
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion gdnative-core/src/core_types/float32_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ godot_test!(
}

for i in 0..8 {
assert_relative_eq!(i as f32 * 2., cow_arr.get(i as i32));
assert_relative_eq!(i as f32 * 2., cow_arr.get(i));
}

// the write shouldn't have affected the original array
Expand Down
2 changes: 1 addition & 1 deletion gdnative-core/src/core_types/int32_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ godot_test!(
}

for i in 0..8 {
assert_eq!(i * 2, cow_arr.get(i as i32));
assert_eq!(i * 2, cow_arr.get(i));
}

// the write shouldn't have affected the original array
Expand Down
2 changes: 1 addition & 1 deletion gdnative-core/src/core_types/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ impl TryFrom<GodotChar> for char {
1 => std::char::from_u32(c.0 as u32).ok_or(GodotCharError::IncompleteSequence),
4 => std::char::from_u32(c.0 as u32).ok_or(GodotCharError::InvalidCodePoint),
2 => {
let mut iter = std::char::decode_utf16(std::iter::once(c.0 as u16));
let mut iter = std::char::decode_utf16(std::iter::once(c.0));
let c = iter
.next()
.ok_or(GodotCharError::InvalidCodePoint)?
Expand Down
6 changes: 3 additions & 3 deletions gdnative-core/src/export/property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,9 @@ bitflags::bitflags! {
const ANIMATE_AS_TRIGGER = sys::godot_property_usage_flags_GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER as u32;
const UPDATE_ALL_IF_MODIFIED = sys::godot_property_usage_flags_GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED as u32;

const DEFAULT = Self::STORAGE.bits | Self::EDITOR.bits | Self::NETWORK.bits as u32;
const DEFAULT_INTL = Self::DEFAULT.bits | Self::INTERNATIONALIZED.bits as u32;
const NOEDITOR = Self::STORAGE.bits | Self::NETWORK.bits as u32;
const DEFAULT = Self::STORAGE.bits | Self::EDITOR.bits | Self::NETWORK.bits;
const DEFAULT_INTL = Self::DEFAULT.bits | Self::INTERNATIONALIZED.bits;
const NOEDITOR = Self::STORAGE.bits | Self::NETWORK.bits;
}
}

Expand Down
7 changes: 2 additions & 5 deletions gdnative-core/src/globalscope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,8 @@ pub fn move_toward(range: RangeInclusive<f32>, delta: f32) -> f32 {
/// ![Image](https://raw.githubusercontent.com/godotengine/godot-docs/3.4/img/ease_cheatsheet.png)
#[inline]
pub fn ease(mut s: f32, curve: f32) -> f32 {
if s < 0.0 {
s = 0.0;
} else if s > 1.0 {
s = 1.0;
}
s = s.clamp(0.0, 1.0);

if curve > 0.0 {
if curve < 1.0 {
1.0 - (1.0 - s).powf(1.0 / curve)
Expand Down
2 changes: 1 addition & 1 deletion gdnative-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
clippy::missing_safety_doc,
clippy::non_send_fields_in_send_ty
)]
#![cfg_attr(feature = "gd-test", allow(clippy::blacklisted_name))]
#![cfg_attr(feature = "gd-test", allow(clippy::disallowed_names))]

#[doc(hidden)]
pub extern crate gdnative_sys as sys;
Expand Down
4 changes: 2 additions & 2 deletions gdnative-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ unsafe fn find_version(
version_minor: u32,
) -> Option<Result<*const godot_gdnative_api_struct, InitError>> {
let mut got = None;
if (*api).type_ as u32 == api_type as u32 {
if (*api).type_ == api_type as u32 {
while !api.is_null() {
// The boolean expression below SHOULD always be true;
// we will double check to be safe.
if (*api).type_ as u32 == api_type as u32 {
if (*api).type_ == api_type as u32 {
let (major, minor) = ((*api).version.major, (*api).version.minor);
if major == version_major && minor == version_minor {
return Some(Ok(api));
Expand Down
2 changes: 1 addition & 1 deletion test/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(clippy::blacklisted_name)]
#![allow(clippy::disallowed_names)]
#![allow(deprecated)]

use gdnative::prelude::*;
Expand Down

0 comments on commit 2d5bf2e

Please sign in to comment.