Skip to content

Commit 00ffddc

Browse files
committed
Set MSRV to 1.51
Reason: --features on a workspace level is not supported before. Further complicating CI scripts, while we already have Rust 1.57, is questionable. Also removes the custom-built clamp(), which was introduced as f32::clamp() in Rust 1.50.
1 parent 1e0f689 commit 00ffddc

File tree

2 files changed

+9
-21
lines changed

2 files changed

+9
-21
lines changed

.github/workflows/full-ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105
- rust: { toolchain: 'nightly' }
106106
testflags: '-- --skip ui_tests'
107107
- os: { id: ubuntu-latest, name: linux }
108-
rust: { toolchain: '1.48', postfix: ' (msrv 1.48)' }
108+
rust: { toolchain: '1.51', postfix: ' (msrv 1.51)' }
109109
testflags: '-- --skip ui_tests'
110110
runs-on: ${{ matrix.os.id }}
111111
steps:
@@ -233,17 +233,21 @@ jobs:
233233
fail-fast: false # cancel all jobs as soon as one fails?
234234
matrix:
235235
include:
236+
# Latest Godot with different Rust versions
236237
- rust: stable
237238
godot: "3.4.1"
238239
postfix: ''
239240
- rust: nightly
240241
godot: "3.4.1"
241242
postfix: ' (nightly)'
242-
- rust: '1.48'
243+
- rust: '1.51'
243244
godot: "3.4.1"
244-
postfix: ' (msrv 1.48)'
245+
postfix: ' (msrv 1.51)'
246+
247+
# Test with older engine version
248+
# Note: headless versions of Godot <= 3.3 may crash with a bug, see feature description in lib.rs
245249
- rust: stable
246-
godot: "3.2"
250+
godot: "3.3.1"
247251
postfix: ''
248252
build_args: '--features custom-godot'
249253

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

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
use crate::core_types::Vector2;
22

3-
/// Clamp method for f32.
4-
/// NOTE: This method was copied as-is from std. This was done to avoid compatibility issues
5-
/// with newer rustc versions and should be removed in favor of f32::clamp once that is stable.
6-
#[inline]
7-
fn clamp(num: f32, min: f32, max: f32) -> f32 {
8-
assert!(min <= max);
9-
let mut x = num;
10-
if x < min {
11-
x = min;
12-
}
13-
if x > max {
14-
x = max;
15-
}
16-
x
17-
}
18-
193
/// Affine 2D transform (2x3 matrix).
204
///
215
/// Represents transformations such as translation, rotation, or scaling.
@@ -228,7 +212,7 @@ impl Transform2D {
228212
// slerp rotation
229213
let v1 = Vector2::new(f32::cos(r1), f32::sin(r1));
230214
let v2 = Vector2::new(f32::cos(r2), f32::sin(r2));
231-
let dot = clamp(v1.dot(v2), -1.0, 1.0);
215+
let dot = v1.dot(v2).clamp(-1.0, 1.0);
232216

233217
let v = if dot > 0.9995 {
234218
//linearly interpolate to avoid numerical precision issues

0 commit comments

Comments
 (0)