Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos, grammar, and spelling mistakes #16273

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions .github/workflows/ci-comment-failures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: 'The generated `examples/README.md` is out of sync with the example metadata in `Cargo.toml` or the example readme template. Please run `cargo run -p build-templated-pages -- update examples` to update it, and commit the file change.'
body: 'The generated `examples/README.md` is out of sync with the example metadata in `Cargo.toml` or the example readme template. Please run `cargo run -p build-templated-pages -- update examples` to update it. Then, commit and push the file change.'
});
}

Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: 'You added a new feature but didn\'t update the readme. Please run `cargo run -p build-templated-pages -- update features` to update it, and commit the file change.'
body: 'You added a new feature but didn\'t update the readme. Please run `cargo run -p build-templated-pages -- update features` to update it. Then, commit and push the file change.'
});
}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
needs: [test, lint, check-compiles, check-doc]
permissions:
issues: write
# Use always() so the job doesn't get canceled if any other jobs fail
# Use always() so that the job doesn't get canceled if any other jobs fail
if: ${{ always() && contains(needs.*.result, 'failure') }}
steps:
- name: Create issue
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,7 @@ path = "examples/asset/multi_asset_sync.rs"
doc-scrape-examples = true

[package.metadata.example.multi_asset_sync]
name = "Mult-asset synchronization"
name = "Multi-asset synchronization"
description = "Demonstrates how to wait for multiple assets to be loaded."
category = "Assets"
wasm = true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ If you'd like to help build Bevy, check out the **[Contributor's Guide](https://
For simple problems, feel free to [open an issue](https://github.com/bevyengine/bevy/issues) or
[PR](https://github.com/bevyengine/bevy/pulls) and tackle it yourself!

For more complex architecture decisions and experimental mad science, please open an [RFC](https://github.com/bevyengine/rfcs) (Request For Comments) so we can brainstorm together effectively!
For more complex architecture decisions and experimental mad science, please open an [RFC](https://github.com/bevyengine/rfcs) (Request For Comments) so that we can brainstorm together effectively!

## Getting Started

Expand Down
4 changes: 2 additions & 2 deletions assets/shaders/specialized_mesh_pipeline.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

struct Vertex {
// This is needed if you are using batching and/or gpu preprocessing
// It's a built in so you don't need to define it in the vertex layout
// It's a built in, so you don't need to define it in the vertex layout
@builtin(instance_index) instance_index: u32,
// Like we defined for the vertex layout
// position is at location 0
Expand Down Expand Up @@ -45,4 +45,4 @@ fn vertex(vertex: Vertex) -> VertexOutput {
fn fragment(in: VertexOutput) -> @location(0) vec4<f32> {
// output the color directly
return vec4(in.color, 1.0);
}
}
10 changes: 5 additions & 5 deletions assets/shaders/tonemapping_test_patterns.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
forward_io::VertexOutput,
}

#import bevy_render::maths::PI
#import bevy_render::math::PI

#ifdef TONEMAP_IN_SHADER
#import bevy_core_pipeline::tonemapping::tone_mapping
#endif

// Sweep across hues on y axis with value from 0.0 to +15EV across x axis
// Sweep across hues on y axis with value from 0.0 to +15EV across x axis
// quantized into 24 steps for both axis.
fn color_sweep(uv_input: vec2<f32>) -> vec3<f32> {
var uv = uv_input;
let steps = 24.0;
uv.y = uv.y * (1.0 + 1.0 / steps);
let ratio = 2.0;

let h = PI * 2.0 * floor(1.0 + steps * uv.y) / steps;
let L = floor(uv.x * steps * ratio) / (steps * ratio) - 0.5;

var color = vec3(0.0);
if uv.y < 1.0 {
if uv.y < 1.0 {
color = cos(h + vec3(0.0, 1.0, 2.0) * PI * 2.0 / 3.0);
let maxRGB = max(color.r, max(color.g, color.b));
let minRGB = min(color.r, min(color.g, color.b));
Expand Down
2 changes: 1 addition & 1 deletion benches/benches/bevy_ecs/scheduling/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub fn build_schedule(criterion: &mut Criterion) {
// Benchmark graphs of different sizes.
for graph_size in [100, 500, 1000] {
// Basic benchmark without constraints.
group.bench_function(format!("{graph_size}_schedule_noconstraints"), |bencher| {
group.bench_function(format!("{graph_size}_schedule_no_constraints"), |bencher| {
bencher.iter(|| {
let mut app = App::new();
for _ in 0..graph_size {
Expand Down
4 changes: 2 additions & 2 deletions benches/benches/bevy_ecs/world/despawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ pub fn world_despawn(criterion: &mut Criterion) {
world.spawn((A(Mat4::default()), B(Vec4::default())));
}

let ents = world.iter_entities().map(|e| e.id()).collect::<Vec<_>>();
let entities = world.iter_entities().map(|e| e.id()).collect::<Vec<_>>();
group.bench_function(format!("{}_entities", entity_count), |bencher| {
bencher.iter(|| {
ents.iter().for_each(|e| {
entities.iter().for_each(|e| {
world.despawn(*e);
});
});
Expand Down
4 changes: 2 additions & 2 deletions benches/benches/bevy_ecs/world/despawn_recursive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ pub fn world_despawn_recursive(criterion: &mut Criterion) {
});
}

let ents = world.iter_entities().map(|e| e.id()).collect::<Vec<_>>();
let entities = world.iter_entities().map(|e| e.id()).collect::<Vec<_>>();
group.bench_function(format!("{}_entities", entity_count), |bencher| {
bencher.iter(|| {
ents.iter().for_each(|e| {
entities.iter().for_each(|e| {
despawn_with_children_recursive(&mut world, *e, true);
});
});
Expand Down
2 changes: 1 addition & 1 deletion benches/benches/bevy_ecs/world/entity_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn make_entity(rng: &mut impl Rng, size: usize) -> Entity {
let x: f64 = rng.gen();
let gen = 1.0 + -(1.0 - x).log2() * 2.0;

// this is not reliable, but we're internal so a hack is ok
// this is not reliable, but we're internal, so a hack is ok
let bits = ((gen as u64) << 32) | (id as u64);
let e = Entity::from_bits(bits);
assert_eq!(e.index(), id as u32);
Expand Down
4 changes: 2 additions & 2 deletions benches/benches/bevy_picking/ray_mesh_intersection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use bevy_math::{Dir3, Mat4, Ray3d, Vec3};
use bevy_picking::mesh_picking::ray_cast;
use criterion::{black_box, criterion_group, criterion_main, Criterion};

fn ptoxznorm(p: u32, size: u32) -> (f32, f32) {
fn p_to_xz_norm(p: u32, size: u32) -> (f32, f32) {
let ij = (p / (size), p % (size));
(ij.0 as f32 / size as f32, ij.1 as f32 / size as f32)
}
Expand All @@ -17,7 +17,7 @@ fn mesh_creation(vertices_per_side: u32) -> SimpleMesh {
let mut positions = Vec::new();
let mut normals = Vec::new();
for p in 0..vertices_per_side.pow(2) {
let xz = ptoxznorm(p, vertices_per_side);
let xz = p_to_xz_norm(p, vertices_per_side);
positions.push([xz.0 - 0.5, 0.0, xz.1 - 0.5]);
normals.push([0.0, 1.0, 0.0]);
}
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_animation/src/animatable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct BlendInput<T> {

/// An animatable value type.
pub trait Animatable: Reflect + Sized + Send + Sync + 'static {
/// Interpolates between `a` and `b` with a interpolation factor of `time`.
/// Interpolates between `a` and `b` with an interpolation factor of `time`.
///
/// The `time` parameter here may not be clamped to the range `[0.0, 1.0]`.
fn interpolate(a: &Self, b: &Self, time: f32) -> Self;
Expand Down Expand Up @@ -211,9 +211,9 @@ where
// (additive) blending and linear interpolation.
//
// Evaluating a Bézier curve via repeated linear interpolation when the
// control points are known is straightforward via [de Casteljau
// subdivision]. So the only remaining problem is to get the two off-curve
// control points. The [derivative of the cubic Bézier curve] is:
// control points are known is straightforward via [de Casteljau subdivision].
// The only remaining problem is to get the two off-curve control points.
// The [derivative of the cubic Bézier curve] is:
//
// B′(t) = 3(1 - t)²(P₁ - P₀) + 6(1 - t)t(P₂ - P₁) + 3t²(P₃ - P₂)
//
Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_animation/src/gltf_curves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,11 @@ fn cubic_spline_interpolation<T>(
where
T: VectorSpace,
{
let coeffs = (vec4(2.0, 1.0, -2.0, 1.0) * lerp + vec4(-3.0, -2.0, 3.0, -1.0)) * lerp;
value_start * (coeffs.x * lerp + 1.0)
+ tangent_out_start * step_duration * lerp * (coeffs.y + 1.0)
+ value_end * lerp * coeffs.z
+ tangent_in_end * step_duration * lerp * coeffs.w
let coefficients = (vec4(2.0, 1.0, -2.0, 1.0) * lerp + vec4(-3.0, -2.0, 3.0, -1.0)) * lerp;
value_start * (coefficients.x * lerp + 1.0)
+ tangent_out_start * step_duration * lerp * (coefficients.y + 1.0)
+ value_end * lerp * coefficients.z
+ tangent_in_end * step_duration * lerp * coefficients.w
}

fn cubic_spline_interpolate_slices<'a, T: VectorSpace>(
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_animation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ impl ActiveAnimation {
///
/// Note that any events between the current time and `seek_time`
/// will be triggered on the next update.
/// Use [`set_seek_time`](Self::set_seek_time) if this is undisered.
/// Use [`set_seek_time`](Self::set_seek_time) if this is undesired.
pub fn seek_to(&mut self, seek_time: f32) -> &mut Self {
self.last_seek_time = Some(self.seek_time);
self.seek_time = seek_time;
Expand All @@ -755,7 +755,7 @@ impl ActiveAnimation {
///
/// Note that any events between the current time and `0.0`
/// will be triggered on the next update.
/// Use [`set_seek_time`](Self::set_seek_time) if this is undisered.
/// Use [`set_seek_time`](Self::set_seek_time) if this is undesired.
pub fn rewind(&mut self) -> &mut Self {
self.last_seek_time = Some(self.seek_time);
self.seek_time = 0.0;
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ impl App {
self
}

/// Registers a system and returns a [`SystemId`] so it can later be called by [`World::run_system`].
/// Registers a system and returns a [`SystemId`] so that it can later be called by [`World::run_system`].
///
/// It's possible to register the same systems more than once, they'll be stored separately.
///
Expand Down Expand Up @@ -1320,7 +1320,7 @@ pub enum AppExit {
}

impl AppExit {
/// Creates a [`AppExit::Error`] with a error code of 1.
/// Creates a [`AppExit::Error`] with an error code of 1.
#[must_use]
pub const fn error() -> Self {
Self::Error(NonZero::<u8>::MIN)
Expand Down Expand Up @@ -1695,8 +1695,8 @@ mod tests {

#[test]
fn app_exit_size() {
// There wont be many of them so the size isn't a issue but
// it's nice they're so small let's keep it that way.
// There wont be many of them, so the size isn't an issue;
// however, it's nice they're so small let's keep it that way.
assert_eq!(size_of::<AppExit>(), size_of::<u8>());
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_app/src/main_schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ pub enum RunFixedMainLoopSystem {
/// [`Time<Virtual>`] and [`Time::overstep`].
///
/// Don't place systems here, use [`FixedUpdate`] and friends instead.
/// Use this system instead to order your systems to run specifically inbetween the fixed update logic and all
/// Use this system instead to order your systems to run specifically in-between the fixed update logic and all
/// other systems that run in [`RunFixedMainLoopSystem::BeforeFixedMainLoop`] or [`RunFixedMainLoopSystem::AfterFixedMainLoop`].
///
/// [`Time<Virtual>`]: https://docs.rs/bevy/latest/bevy/prelude/struct.Virtual.html
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_asset/src/io/android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ impl AssetReader for AndroidAssetReader {
// The solution here was to first use `open_dir` to eliminate the case
// when the path does not exist at all, and then to use `open` to
// see if that path is a file or a directory
let cpath = CString::new(path.to_str().unwrap()).unwrap();
let c_path = CString::new(path.to_str().unwrap()).unwrap();
let _ = asset_manager
.open_dir(&cpath)
.open_dir(&c_path)
.ok_or(AssetReaderError::NotFound(path.to_path_buf()))?;
Ok(asset_manager.open(&cpath).is_none())
Ok(asset_manager.open(&c_path).is_none())
}
}
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/io/file/file_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ pub(crate) fn new_asset_event_debouncer(
}
(true, false) => {
error!(
"Asset metafile {old_path:?} was changed to asset file {new_path:?}, which is not supported. Try restarting your app to see if configuration is still valid"
"Asset meta file {old_path:?} was changed to asset file {new_path:?}, which is not supported. Try restarting your app to see if configuration is still valid"
);
}
(false, true) => {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/io/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ pub mod test {
let dir = Dir::default();
let a_path = Path::new("a.txt");
let a_data = "a".as_bytes().to_vec();
let a_meta = "ameta".as_bytes().to_vec();
let a_meta = "a meta".as_bytes().to_vec();

dir.insert_asset(a_path, a_data.clone());
let asset = dir.get_asset(a_path).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_asset/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ impl Plugin for AssetPlugin {
.configure_sets(PreUpdate, TrackAssets.after(handle_internal_asset_events))
// `handle_internal_asset_events` requires the use of `&mut World`,
// and as a result has ambiguous system ordering with all other systems in `PreUpdate`.
// This is virtually never a real problem: asset loading is async and so anything that interacts directly with it
// This is virtually never a real problem: asset loading is async, thus anything that interacts directly with it
// needs to be robust to stochastic delays anyways.
.add_systems(PreUpdate, handle_internal_asset_events.ambiguous_with_all())
.register_type::<AssetPath>();
Expand Down Expand Up @@ -910,7 +910,7 @@ mod tests {
}

// Allow "a" to load ... wait for it to finish loading and validate results
// Dependencies are still gated so they should not be loaded yet
// Dependencies are still gated, so they should not be loaded yet
gate_opener.open(a_path);
run_app_until(&mut app, |world| {
let a_text = get::<CoolText>(world, a_id)?;
Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_asset/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ impl<'a> AssetPath<'a> {
// It's a label only
Ok(self.clone_owned().with_label(label.to_owned()))
} else {
let (source, rpath, rlabel) = AssetPath::parse_internal(path)?;
let (source, r_path, r_label) = AssetPath::parse_internal(path)?;
let mut base_path = PathBuf::from(self.path());
if replace && !self.path.to_str().unwrap().ends_with('/') {
// No error if base is empty (per RFC 1808).
Expand All @@ -420,20 +420,20 @@ impl<'a> AssetPath<'a> {

// Strip off leading slash
let mut is_absolute = false;
let rpath = match rpath.strip_prefix("/") {
let r_path = match r_path.strip_prefix("/") {
Ok(p) => {
is_absolute = true;
p
}
_ => rpath,
_ => r_path,
};

let mut result_path = if !is_absolute && source.is_none() {
base_path
} else {
PathBuf::new()
};
result_path.push(rpath);
result_path.push(r_path);
result_path = normalize_path(result_path.as_path());

Ok(AssetPath {
Expand All @@ -442,7 +442,7 @@ impl<'a> AssetPath<'a> {
None => self.source.clone_owned(),
},
path: CowArc::Owned(result_path.into()),
label: rlabel.map(|l| CowArc::Owned(l.into())),
label: r_label.map(|l| CowArc::Owned(l.into())),
})
}
}
Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_asset/src/processor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ use std::path::{Path, PathBuf};
/// A [`ProcessorTransactionLog`] is produced, which uses "write-ahead logging" to make the [`AssetProcessor`] crash and failure resistant. If a failed/unfinished
/// transaction from a previous run is detected, the affected asset(s) will be re-processed.
///
/// [`AssetProcessor`] can be cloned. It is backed by an [`Arc`] so clones will share state. Clones can be freely used in parallel.
/// [`AssetProcessor`] can be cloned. It is backed by an [`Arc`], so clones will share state. Clones can be freely used in parallel.
#[derive(Resource, Clone)]
pub struct AssetProcessor {
server: AssetServer,
Expand Down Expand Up @@ -276,7 +276,7 @@ impl AssetProcessor {
AssetSourceEvent::AddedFolder(path) => {
self.handle_added_folder(source, path).await;
}
// NOTE: As a heads up for future devs: this event shouldn't be run in parallel with other events that might
// NOTE: As a heads up for future developers: this event shouldn't be run in parallel with other events that might
// touch this folder (ex: the folder might be re-created with new assets). Clean up the old state first.
// Currently this event handler is not parallel, but it could be (and likely should be) in the future.
AssetSourceEvent::RemovedFolder(path) => {
Expand Down Expand Up @@ -698,7 +698,7 @@ impl AssetProcessor {
async fn clean_empty_processed_ancestor_folders(&self, source: &AssetSource, path: &Path) {
// As a safety precaution don't delete absolute paths to avoid deleting folders outside of the destination folder
if path.is_absolute() {
error!("Attempted to clean up ancestor folders of an absolute path. This is unsafe so the operation was skipped.");
error!("Attempted to clean up ancestor folders of an absolute path. This is unsafe, so the operation was skipped.");
return;
}
while let Some(parent) = path.parent() {
Expand Down Expand Up @@ -924,11 +924,11 @@ impl AssetProcessor {
if let Err(err) = ProcessorTransactionLog::validate().await {
let state_is_valid = match err {
ValidateLogError::ReadLogError(err) => {
error!("Failed to read processor log file. Processed assets cannot be validated so they must be re-generated {err}");
error!("Failed to read processor log file. Processed assets cannot be validated, so they must be re-generated {err}");
false
}
ValidateLogError::UnrecoverableError => {
error!("Encountered an unrecoverable error in the last run. Processed assets cannot be validated so they must be re-generated");
error!("Encountered an unrecoverable error in the last run. Processed assets cannot be validated, so they must be re-generated.");
false
}
ValidateLogError::EntryErrors(entry_errors) => {
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_asset/src/reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,13 @@ mod tests {

let handle = reflect_asset.add(app.world_mut(), &value);
// struct is a reserved keyword, so we can't use it here
let strukt = reflect_asset
let r#struct = reflect_asset
.get_mut(app.world_mut(), handle)
.unwrap()
.reflect_mut()
.as_struct()
.unwrap();
strukt
r#struct
.field_mut("field")
.unwrap()
.apply(&String::from("edited"));
Expand Down
Loading