Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions crates/bevy_app/src/plugin_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ impl PluginGroupBuilder {
.find(|(_i, ty)| **ty == TypeId::of::<Target>())
.map(|(i, _)| i)
.unwrap_or_else(|| {
panic!("Plugin does not exist: {}", std::any::type_name::<Target>())
panic!(
"Plugin does not exist: {}.",
std::any::type_name::<Target>()
)
});
self.order.insert(target_index, TypeId::of::<T>());
self.plugins.insert(
Expand All @@ -59,7 +62,10 @@ impl PluginGroupBuilder {
.find(|(_i, ty)| **ty == TypeId::of::<Target>())
.map(|(i, _)| i)
.unwrap_or_else(|| {
panic!("Plugin does not exist: {}", std::any::type_name::<Target>())
panic!(
"Plugin does not exist: {}.",
std::any::type_name::<Target>()
)
});
self.order.insert(target_index + 1, TypeId::of::<T>());
self.plugins.insert(
Expand All @@ -76,7 +82,7 @@ impl PluginGroupBuilder {
let mut plugin_entry = self
.plugins
.get_mut(&TypeId::of::<T>())
.expect("Cannot enable a plugin that does not exist");
.expect("Cannot enable a plugin that does not exist.");
plugin_entry.enabled = true;
self
}
Expand All @@ -85,7 +91,7 @@ impl PluginGroupBuilder {
let mut plugin_entry = self
.plugins
.get_mut(&TypeId::of::<T>())
.expect("Cannot disable a plugin that does not exist");
.expect("Cannot disable a plugin that does not exist.");
plugin_entry.enabled = false;
self
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_app/src/schedule_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl Plugin for ScheduleRunnerPlugin {
f.as_ref().unchecked_ref(),
dur.as_millis() as i32,
)
.expect("should register `setTimeout`");
.expect("Should register `setTimeout`.");
}
let asap = Duration::from_millis(1);

Expand Down
20 changes: 10 additions & 10 deletions crates/bevy_asset/src/asset_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ use thiserror::Error;
/// Errors that occur while loading assets with an AssetServer
#[derive(Error, Debug)]
pub enum AssetServerError {
#[error("Asset folder path is not a directory.")]
#[error("asset folder path is not a directory")]
AssetFolderNotADirectory(String),
#[error("No AssetLoader found for the given extension.")]
#[error("no AssetLoader found for the given extension")]
MissingAssetLoader(Option<String>),
#[error("The given type does not match the type of the loaded asset.")]
#[error("the given type does not match the type of the loaded asset")]
IncorrectHandleType,
#[error("Encountered an error while loading an asset.")]
#[error("encountered an error while loading an asset")]
AssetLoaderError(anyhow::Error),
#[error("PathLoader encountered an error")]
#[error("`PathLoader` encountered an error")]
PathLoaderError(#[from] AssetIoError),
}

Expand Down Expand Up @@ -238,7 +238,7 @@ impl AssetServer {
let mut asset_sources = self.server.asset_sources.write();
let source_info = asset_sources
.get_mut(&asset_path_id.source_path_id())
.expect("AssetSource should exist at this point");
.expect("`AssetSource` should exist at this point.");
if version != source_info.version {
return Ok(asset_path_id);
}
Expand Down Expand Up @@ -317,7 +317,7 @@ impl AssetServer {
continue;
}
let handle =
self.load_untyped(child_path.to_str().expect("Path should be a valid string"));
self.load_untyped(child_path.to_str().expect("Path should be a valid string."));
handles.push(handle);
}
}
Expand All @@ -334,7 +334,7 @@ impl AssetServer {
let ref_change = match receiver.try_recv() {
Ok(ref_change) => ref_change,
Err(TryRecvError::Empty) => break,
Err(TryRecvError::Disconnected) => panic!("RefChange channel disconnected"),
Err(TryRecvError::Disconnected) => panic!("RefChange channel disconnected."),
};
match ref_change {
RefChange::Increment(handle_id) => *ref_counts.entry(handle_id).or_insert(0) += 1,
Expand Down Expand Up @@ -377,7 +377,7 @@ impl AssetServer {
let asset_value = asset
.value
.take()
.expect("Asset should exist at this point");
.expect("Asset should exist at this point.");
if let Some(asset_lifecycle) = asset_lifecycles.get(&asset_value.type_uuid()) {
let asset_path =
AssetPath::new_ref(&load_context.path, label.as_ref().map(|l| l.as_str()));
Expand Down Expand Up @@ -431,7 +431,7 @@ impl AssetServer {
Err(TryRecvError::Empty) => {
break;
}
Err(TryRecvError::Disconnected) => panic!("AssetChannel disconnected"),
Err(TryRecvError::Disconnected) => panic!("AssetChannel disconnected."),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_asset/src/filesystem_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ impl Default for FilesystemWatcher {
fn default() -> Self {
let (sender, receiver) = crossbeam_channel::unbounded();
let watcher: RecommendedWatcher = Watcher::new_immediate(move |res| {
sender.send(res).expect("Watch event send failure");
sender.send(res).expect("Watch event send failure.");
})
.expect("Failed to create filesystem watcher");
.expect("Failed to create filesystem watcher.");
FilesystemWatcher { watcher, receiver }
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ impl HandleUntyped {
pub fn typed<T: Asset>(mut self) -> Handle<T> {
if let HandleId::Id(type_uuid, _) = self.id {
if T::TYPE_UUID != type_uuid {
panic!("attempted to convert handle to invalid type");
panic!("Attempted to convert handle to invalid type.");
}
}
let handle_type = match &self.handle_type {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/io/file_asset_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pub fn filesystem_watcher_system(asset_server: Res<AssetServer>) {
let event = match watcher.receiver.try_recv() {
Ok(result) => result.unwrap(),
Err(TryRecvError::Empty) => break,
Err(TryRecvError::Disconnected) => panic!("FilesystemWatcher disconnected"),
Err(TryRecvError::Disconnected) => panic!("FilesystemWatcher disconnected."),
};
if let notify::event::Event {
kind: notify::event::EventKind::Modify(_),
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_asset/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ use thiserror::Error;
/// Errors that occur while loading assets
#[derive(Error, Debug)]
pub enum AssetIoError {
#[error("Path not found")]
#[error("path not found")]
NotFound(PathBuf),
#[error("Encountered an io error while loading asset.")]
#[error("encountered an io error while loading asset")]
Io(#[from] io::Error),
#[error("Failed to watch path")]
#[error("failed to watch path")]
PathWatchError(PathBuf),
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl Plugin for AssetPlugin {
let task_pool = app
.resources()
.get::<IoTaskPool>()
.expect("IoTaskPool resource not found")
.expect("`IoTaskPool` resource not found.")
.0
.clone();

Expand Down
5 changes: 4 additions & 1 deletion crates/bevy_asset/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ impl<T: AssetDynamic> AssetLifecycle for AssetLifecycleChannel<T> {
}))
.unwrap()
} else {
panic!("failed to downcast asset to {}", std::any::type_name::<T>());
panic!(
"Failed to downcast asset to {}.",
std::any::type_name::<T>()
);
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl<'a, 'b> From<&'a AssetPath<'b>> for AssetPathId {
impl<'a> From<&'a str> for AssetPath<'a> {
fn from(asset_path: &'a str) -> Self {
let mut parts = asset_path.split('#');
let path = Path::new(parts.next().expect("path must be set"));
let path = Path::new(parts.next().expect("Path must be set."));
let label = parts.next();
AssetPath {
path: Cow::Borrowed(path),
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_derive/src/bevy_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use syn::{parse_macro_input, ItemFn};
pub fn bevy_main(_attr: TokenStream, item: TokenStream) -> TokenStream {
let input = parse_macro_input!(item as ItemFn);
if input.sig.ident != "main" {
panic!("bevy_main can only be used on a function called 'main'")
panic!("`bevy_main` can only be used on a function called 'main'.")
}

TokenStream::from(quote! {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_derive/src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn derive_bytes(input: TokenStream) -> TokenStream {
fields: Fields::Named(fields),
..
}) => &fields.named,
_ => panic!("expected a struct with named fields"),
_ => panic!("Expected a struct with named fields."),
};

let modules = get_modules(&ast.attrs);
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_derive/src/render_resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn derive_render_resources(input: TokenStream) -> TokenStream {
}
Ok(())
})
.expect("invalid 'render_resources' attribute format");
.expect("Invalid 'render_resources' attribute format.");

attributes
});
Expand Down Expand Up @@ -77,7 +77,7 @@ pub fn derive_render_resources(input: TokenStream) -> TokenStream {
fields: Fields::Named(fields),
..
}) => &fields.named,
_ => panic!("expected a struct with named fields"),
_ => panic!("Expected a struct with named fields."),
};
let field_attributes = fields
.iter()
Expand All @@ -102,7 +102,7 @@ pub fn derive_render_resources(input: TokenStream) -> TokenStream {
}
Ok(())
})
.expect("invalid 'render_resources' attribute format");
.expect("Invalid 'render_resources' attribute format.");

attributes
}),
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_derive/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn derive_from_resources(input: TokenStream) -> TokenStream {
fields: Fields::Named(fields),
..
}) => &fields.named,
_ => panic!("expected a struct with named fields"),
_ => panic!("Expected a struct with named fields."),
};

let modules = get_modules(&ast.attrs);
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_derive/src/shader_defs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn derive_shader_defs(input: TokenStream) -> TokenStream {
fields: Fields::Named(fields),
..
}) => &fields.named,
_ => panic!("expected a struct with named fields"),
_ => panic!("Expected a struct with named fields."),
};

let shader_def_idents = fields
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ pub fn derive_system_param(input: TokenStream) -> TokenStream {
fields: Fields::Named(fields),
..
}) => &fields.named,
_ => panic!("expected a struct with named fields"),
_ => panic!("Expected a struct with named fields."),
};

let manifest = Manifest::new().unwrap();
Expand Down Expand Up @@ -386,7 +386,7 @@ pub fn derive_system_param(input: TokenStream) -> TokenStream {
}
Ok(())
})
.expect("invalid 'render_resources' attribute format");
.expect("Invalid 'render_resources' attribute format.");

attributes
}),
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_ecs/src/core/archetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl Archetype {
"attempted to allocate entity with duplicate components; \
each type must occur at most once!"
),
core::cmp::Ordering::Greater => panic!("type info is unsorted"),
core::cmp::Ordering::Greater => panic!("Type info is unsorted."),
});
}

Expand Down Expand Up @@ -160,7 +160,7 @@ impl Archetype {
.get(&TypeId::of::<T>())
.map_or(false, |x| !x.borrow.borrow())
{
panic!("{} already borrowed uniquely", type_name::<T>());
panic!("{} already borrowed uniquely.", type_name::<T>());
}
}

Expand All @@ -172,7 +172,7 @@ impl Archetype {
.get(&TypeId::of::<T>())
.map_or(false, |x| !x.borrow.borrow_mut())
{
panic!("{} already borrowed", type_name::<T>());
panic!("{} already borrowed.", type_name::<T>());
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/core/entities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl Entities {
id: u32::try_from(self.meta.len())
.ok()
.and_then(|x| x.checked_add(n))
.expect("too many entities"),
.expect("Too many entities."),
}
}
// The freelist has entities in it, so move the last entry to the reserved list, to
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/core/entity_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use thiserror::Error;

#[derive(Error, Debug)]
pub enum MapEntitiesError {
#[error("The given entity does not exist in the map.")]
#[error("the given entity does not exist in the map")]
EntityNotFound(Entity),
}

Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_ecs/src/resource/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ impl Resources {
Ordering::Equal => {
storage.push(resource);
}
Ordering::Greater => panic!("attempted to access index beyond 'current_capacity + 1'"),
Ordering::Greater => panic!("Attempted to access index beyond 'current_capacity + 1'."),
Ordering::Less => {
*storage.get_mut(index).unwrap() = resource;
}
Expand Down Expand Up @@ -279,7 +279,7 @@ impl Resources {
.unwrap();
resources.get_unsafe_ref(index)
})
.unwrap_or_else(|| panic!("Resource does not exist {}", std::any::type_name::<T>()))
.unwrap_or_else(|| panic!("Resource does not exist {}.", std::any::type_name::<T>()))
}

#[inline]
Expand All @@ -301,7 +301,7 @@ impl Resources {
NonNull::new_unchecked(resources.stored[index].mutated.get()),
)
})
.unwrap_or_else(|| panic!("Resource does not exist {}", std::any::type_name::<T>()))
.unwrap_or_else(|| panic!("Resource does not exist {}.", std::any::type_name::<T>()))
}

#[inline]
Expand Down Expand Up @@ -372,7 +372,7 @@ impl<'a, T: 'static> ResourceRef<'a, T> {
}
} else {
panic!(
"Failed to acquire shared lock on resource: {}",
"Failed to acquire shared lock on resource: {}.",
std::any::type_name::<T>()
);
}
Expand Down Expand Up @@ -432,7 +432,7 @@ impl<'a, T: 'static> ResourceRefMut<'a, T> {
}
} else {
panic!(
"Failed to acquire exclusive lock on resource: {}",
"Failed to acquire exclusive lock on resource: {}.",
std::any::type_name::<T>()
);
}
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/src/schedule/parallel_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ impl ExecutorStage {
self.ready_events_of_dependents[system_index].push(
self.ready_events[*dependent_system]
.as_ref()
.expect("A dependent task should have a non-None ready event")
.expect("A dependent task should have a non-None ready event.")
.clone(),
);
}
Expand Down Expand Up @@ -318,7 +318,7 @@ impl ExecutorStage {
if dependency_count > 0 {
self.ready_events[system_index]
.as_ref()
.expect("A system with >0 dependency count should have a non-None ready event")
.expect("A system with >0 dependency count should have a non-None ready event.")
.reset(dependency_count as isize)
}
}
Expand Down
Loading