Skip to content

Commit dbbd59c

Browse files
authored
Merge pull request #802 from godot-rust/qol/small-cleanup
Typos + code reordering
2 parents 3e24714 + c1479a8 commit dbbd59c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+238
-257
lines changed

.github/workflows/release-version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ jobs:
179179
# # Note: first block was for an alternative approach, where a separate `releases` branch tracks deployments.
180180
# # Such a branch would however be disjoint and require quite a bit of extra space in the repo.
181181
# run: |
182-
# # Backup current repo, so we can checkout.
182+
# # Backup current repo, so we can check out.
183183
# mkdir -p /tmp/repo
184184
# rsync -av --exclude .git --exclude target ./ /tmp/repo/
185185
# git fetch origin releases && git switch releases || git switch --orphan releases

godot-bindings/src/godot_version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn test_godot_versions() {
9090
("4.0.rc1.official.8843d9ad3", 4, 0, 0, "rc1", s("8843d9ad3")),
9191
("4.0.stable.arch_linux", 4, 0, 0, "stable", None),
9292
("4.1.1.stable.arch_linux\n", 4, 1, 1, "stable", None),
93-
// Output from 4.0.stable on MacOS in debug mode:
93+
// Output from 4.0.stable on macOS in debug mode:
9494
// https://github.com/godotengine/godot/issues/74906
9595
("arguments
9696
0: /Users/runner/work/_temp/godot_bin/godot.macos.editor.dev.x86_64

godot-cell/src/blocking_cell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::blocking_guards::{MutGuardBlocking, RefGuardBlocking};
1515
use crate::cell::GdCellInner;
1616
use crate::guards::InaccessibleGuard;
1717

18-
/// Blocking version of [`panicking::GdCell`](crate::panicking::GdCell) for multi-threaded usage.
18+
/// Blocking version of [`panicking::GdCell`](crate::panicking::GdCell) for multithreaded usage.
1919
///
2020
/// This version of GdCell blocks the current thread if it does not yet hold references to the cell.
2121
///

godot-cell/src/cell.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<T> GdCellInner<T> {
121121
let value = state.get_ptr();
122122

123123
// SAFETY: `increment_mut` succeeded, therefore any existing mutable references are inaccessible.
124-
// Additionally no new references can be created, unless the returned guard is made inaccessible.
124+
// Additionally, no new references can be created, unless the returned guard is made inaccessible.
125125
//
126126
// This is the case because the only way for a new `GdMut` or `GdRef` to be made after this is for
127127
// either this guard to be dropped or `make_inaccessible` to be called and succeed.
@@ -170,10 +170,9 @@ impl<T> GdCellInner<T> {
170170
}
171171
}
172172

173-
// SAFETY: `T` is sync so we can return references to it on different threads, it is also send so we can return
174-
// mutable references to it on different threads.
175-
// Additionally all internal state is synchronized via a mutex, so we wont have race conditions when trying
176-
// to use it from multiple threads.
173+
// SAFETY: `T` is Sync, so we can return references to it on different threads.
174+
// It is also Send, so we can return mutable references to it on different threads.
175+
// Additionally, all internal state is synchronized via a mutex, so we won't have race conditions when trying to use it from multiple threads.
177176
unsafe impl<T: Send + Sync> Sync for GdCellInner<T> {}
178177

179178
/// Mutable state of the `GdCell`, bundled together to make it easier to avoid deadlocks when locking the
@@ -227,7 +226,7 @@ impl<T> CellState<T> {
227226
NonNull::new(self.ptr).unwrap()
228227
}
229228

230-
/// Push a pointer to this state..
229+
/// Push a pointer to this state.
231230
pub(crate) fn push_ptr(&mut self, new_ptr: NonNull<T>) -> usize {
232231
self.ptr = new_ptr.as_ptr();
233232
self.stack_depth += 1;

godot-cell/src/guards.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl<'a, T> Drop for MutGuard<'a, T> {
196196
/// creation. When the guard is dropped, `state`'s pointer is reset to the original pointer.
197197
///
198198
/// This ensures that any new references are derived from the new reference we pass in, and when this guard
199-
/// is dropped the state is reset to what it was before, as if this guard never existed.
199+
/// is dropped, it resets the state to what it was before, as if this guard never existed.
200200
#[derive(Debug)]
201201
pub struct InaccessibleGuard<'a, T> {
202202
state: &'a Mutex<CellState<T>>,

godot-cell/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
//! reference (or other pointer) to some value is considered accessible when it is possible to either read
2626
//! from or write to the value it points to without using `unsafe`. Importantly, if we know that a reference
2727
//! `a` is inaccessible, and then we create a new reference `b` derived from `a` to the same value, then we
28-
//! know for sure that `b` wont alias `a`. This is because aliasing in rust is based on accesses, and if we
28+
//! know for sure that `b` won't alias `a`. This is because aliasing in rust is based on accesses, and if we
2929
//! never access `a` then we cannot ever violate aliasing for `a` and `b`. And since `b` is derived from `a`
3030
//! (that is, `b` was created from `a` somehow such as by casting `a` to a raw pointer then to a reference
31-
//! `b`), then `a` wont get invalidated by accesses to `b`.
31+
//! `b`), then `a` won't get invalidated by accesses to `b`.
3232
3333
mod blocking_cell;
3434
mod blocking_guards;

godot-cell/tests/mock/blocking.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl MyClass {
3232

3333
/// Call each method from different threads, allowing them to run in parallel.
3434
///
35-
/// This should not cause borrow failures and should not lead to dead locks.
35+
/// This should not cause borrow failures and should not lead to deadlocks.
3636
#[test]
3737
fn calls_parallel() {
3838
use std::thread;
@@ -61,7 +61,7 @@ fn calls_parallel() {
6161

6262
/// Call each method from different threads, allowing them to run in parallel.
6363
///
64-
/// This should not cause borrow failures and should not lead to dead locks.
64+
/// This should not cause borrow failures and should not lead to deadlocks.
6565
///
6666
/// Runs each method several times in a row. This should reduce the non-determinism that comes from
6767
/// scheduling of threads.
@@ -95,7 +95,7 @@ fn calls_parallel_many_serial() {
9595

9696
/// Call each method from different threads, allowing them to run in parallel.
9797
///
98-
/// This should not cause borrow failures and should not lead to dead locks.
98+
/// This should not cause borrow failures and should not lead to deadlocks.
9999
///
100100
/// Runs all the tests several times. This is different from [`calls_parallel_many_serial`] as that calls the
101101
/// methods like AAA...BBB...CCC..., whereas this interleaves the methods like ABC...ABC...ABC...

godot-cell/tests/mock/panicking.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ fn calls_different_thread() {
8383
/// Call each method from different threads, allowing them to run in parallel.
8484
///
8585
/// This may cause borrow failures, we do a best-effort attempt at estimating the value then. We can detect
86-
/// if the first call failed, so then we know the integer was incremented by 0. Otherwise we at least know
86+
/// if the first call failed, so then we know the integer was incremented by 0. Otherwise, we at least know
8787
/// the range of values that it can be incremented by.
8888
#[test]
8989
fn calls_parallel() {
@@ -114,7 +114,7 @@ fn calls_parallel() {
114114
/// Call each method from different threads, allowing them to run in parallel.
115115
///
116116
/// This may cause borrow failures, we do a best-effort attempt at estimating the value then. We can detect
117-
/// if the first call failed, so then we know the integer was incremented by 0. Otherwise we at least know
117+
/// if the first call failed, so then we know the integer was incremented by 0. Otherwise, we at least know
118118
/// the range of values that it can be incremented by.
119119
///
120120
/// Runs each method several times in a row. This should reduce the non-determinism that comes from
@@ -150,7 +150,7 @@ fn calls_parallel_many_serial() {
150150
/// Call each method from different threads, allowing them to run in parallel.
151151
///
152152
/// This may cause borrow failures, we do a best-effort attempt at estimating the value then. We can detect
153-
/// if the first call failed, so then we know the integer was incremented by 0. Otherwise we at least know
153+
/// if the first call failed, so then we know the integer was incremented by 0. Otherwise, we at least know
154154
/// the range of values that it can be incremented by.
155155
///
156156
/// Runs all the tests several times. This is different from [`calls_parallel_many_serial`] as that calls the

godot-codegen/src/conv/name_conversions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ fn try_strip_prefixes<'e>(enumerator: &'e str, prefixes: &[&str]) -> &'e str {
280280
enumerator
281281
}
282282

283-
/// Check if input is a valid identifier; ie. no special characters except '_' and not starting with a digit.
283+
/// Check if input is a valid identifier; i.e. no special characters except '_' and not starting with a digit.
284284
fn is_valid_ident(s: &str) -> bool {
285285
!starts_with_invalid_char(s) && s.chars().all(|c| c == '_' || c.is_ascii_alphanumeric())
286286
}

godot-codegen/src/conv/type_conversions.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn to_hardcoded_rust_enum(ty: &str) -> Option<&str> {
8282
Some(result)
8383
}
8484

85-
/// Maps an input type to a Godot type with the same C representation. This is subtly different than [`to_rust_type`],
85+
/// Maps an input type to a Godot type with the same C representation. This is subtly different from [`to_rust_type`],
8686
/// which maps to an appropriate corresponding Rust type. This function should be used in situations where the C ABI for
8787
/// a type must match the Godot equivalent exactly, such as when dealing with pointers.
8888
pub(crate) fn to_rust_type_abi(ty: &str, ctx: &mut Context) -> (RustTy, bool) {
@@ -105,7 +105,7 @@ pub(crate) fn to_rust_type_abi(ty: &str, ctx: &mut Context) -> (RustTy, bool) {
105105
(ty, is_obj)
106106
}
107107

108-
/// Maps an _input_ type from the Godot JSON to the corresponding Rust type (wrapping some sort of a token stream).
108+
/// Maps an _input_ type from the Godot JSON to the corresponding Rust type (wrapping some sort of token stream).
109109
///
110110
/// Uses an internal cache (via `ctx`), as several types are ubiquitous.
111111
// TODO take TyName as input
@@ -401,7 +401,7 @@ fn to_rust_expr_inner(expr: &str, ty: &RustTy, is_inner: bool) -> TokenStream {
401401
}
402402

403403
fn suffixed_lit(num: impl fmt::Display, suffix: &Ident) -> TokenStream {
404-
// i32, u16 etc happens to be also the literal suffix
404+
// i32, u16 etc. happen to be also the literal suffixes
405405
let combined = format!("{num}{suffix}");
406406
combined
407407
.parse::<Literal>()

0 commit comments

Comments
 (0)