Skip to content

Commit 99a0dee

Browse files
bors[bot]jacobsky
andauthored
Merge #731
731: Lower-case error messages without trailing punctuation r=toasteater a=jacobsky As per Issue #702 changing the format of the errors message to follow the standard listed here: https://rust-lang.github.io/api-guidelines/interoperability.html#error-types-are-meaningful-and-well-behaved-c-good-err I looked through both the errors and the display impls and these were the only ones that I found that broke the interoperability rules listed in issue#702 Tests still appear to be passing and the changes didn't appear to cause issues with clippy. If there are any questions with the wording, please let me know. Co-authored-by: Jacobsky <cael.jacobsen@gmail.com>
2 parents 7050701 + a5a6f99 commit 99a0dee

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

gdnative-core/src/core_types/variant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ impl fmt::Display for FromVariantError {
12161216
write!(f, "invalid value for variant {}: {}", variant, error)
12171217
}
12181218
E::InvalidInstance { expected } => {
1219-
write!(f, "object is not an instance of NativeClass {}", expected)
1219+
write!(f, "object is not an instance of `NativeClass` {}", expected)
12201220
}
12211221
E::InvalidField { field_name, error } => {
12221222
write!(f, "invalid value for field {}", field_name)?;

gdnative-core/src/nativescript/user_data.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ pub enum Infallible {}
170170
impl std::fmt::Display for Infallible {
171171
#[inline]
172172
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
173-
write!(f, "Operation that can't fail just failed")
173+
write!(f, "operation that can't fail just failed")
174174
}
175175
}
176176

@@ -232,8 +232,8 @@ impl std::fmt::Display for LockFailed {
232232
#[inline]
233233
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
234234
match self {
235-
LockFailed::Timeout(wait) => write!(f, "Failed to acquire lock within {:?}", wait),
236-
LockFailed::Pessimistic => write!(f, "Failed to acquire lock, it was already held."),
235+
LockFailed::Timeout(wait) => write!(f, "failed to acquire lock within {:?}", wait),
236+
LockFailed::Pessimistic => write!(f, "failed to acquire lock, it was already held"),
237237
}
238238
}
239239
}
@@ -559,13 +559,13 @@ mod local_cell {
559559
match self {
560560
LocalCellError::DifferentThread { original, current } => write!(
561561
f,
562-
"Accessing from the wrong thread, expected {:?} found {:?}",
562+
"accessing from the wrong thread, expected {:?} found {:?}",
563563
original, current
564564
),
565565
LocalCellError::BorrowFailed => write!(
566566
f,
567-
"Borrow failed; a &mut reference was requested, but one already exists. Cause is likely a re-entrant call \
568-
(e.g. a GDNative Rust method calls to GDScript, which again calls a Rust method on the same object)."
567+
"borrow failed; a &mut reference was requested, but one already exists. The cause is likely a re-entrant call \
568+
(e.g. a GDNative Rust method calls to GDScript, which again calls a Rust method on the same object)"
569569
),
570570
}
571571
}

0 commit comments

Comments
 (0)