Skip to content

Commit 4d1687b

Browse files
committed
Small fixes after #[cfg(since_api = "4.2")] is part of clippy/test
Some problems were previously undetected, since CI ran with 4.1.1-stable, excluding newer code paths. Concretely: - Fix Latin-1 character incorrectly represented in string lateral. - Clippy lints related to Callable and its tests.
1 parent 5c8953c commit 4d1687b

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

godot-core/src/builtin/callable.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ mod custom_callable {
375375
///
376376
/// Return `Ok(...)` if the call succeeded, and `Err(())` otherwise.
377377
/// Error handling is mostly needed in case argument number or types mismatch.
378+
#[allow(clippy::result_unit_err)] // TODO remove once there's a clear error type here.
378379
fn invoke(&mut self, args: &[&Variant]) -> Result<Variant, ()>;
379380
}
380381

godot-core/src/builtin/string/string_name.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ impl StringName {
3636
/// ```no_run
3737
/// use godot::builtin::StringName;
3838
///
39-
/// let sname = StringName::from_latin1_with_nul(b"± Latin-1 string\0");
39+
/// // '±' is a Latin-1 character with codepoint 0xB1. Note that this is not UTF-8, where it would need two bytes.
40+
/// let sname = StringName::from_latin1_with_nul(b"\xb1 Latin-1 string\0");
4041
/// ```
4142
///
4243
/// # Panics

itest/rust/src/builtin_tests/containers/callable_test.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,11 @@ mod custom_callable {
220220
let b = Callable::from_custom(Adder::new_tracked(3, bt.clone()));
221221
let c = Callable::from_custom(Adder::new_tracked(4, ct.clone()));
222222

223-
assert_eq!(a, a);
223+
// clippy complains with assert_eq!(a, a) and it can't be suppressed with the suggested #[allow(clippy::eq_op)], hence this ceremony.
224+
#[allow(clippy::eq_op)]
225+
if a != a {
226+
panic!("a != a; left: {a:?}, right: {a:?}");
227+
}
224228
assert_eq!(
225229
eq_count(&at),
226230
0,

0 commit comments

Comments
 (0)