Skip to content

Commit 130953c

Browse files
committedJan 9, 2022
Enable the doc_markdown clippy lint (bevyengine#3457)
# Objective CI should check for missing backticks in doc comments. Fixes bevyengine#3435 ## Solution `clippy` has a lint for this: `doc_markdown`. This enables that lint in the CI script. Of course, enabling this lint in CI causes a bunch of lint errors, so I've gone through and fixed all of them. This was a huge edit that touched a ton of files, so I split the PR up by crate. When all of the following are merged, the CI should pass and this can be merged. + [x] bevyengine#3467 + [x] bevyengine#3468 + [x] bevyengine#3470 + [x] bevyengine#3469 + [x] bevyengine#3471 + [x] bevyengine#3472 + [x] bevyengine#3473 + [x] bevyengine#3474 + [x] bevyengine#3475 + [x] bevyengine#3476 + [x] bevyengine#3477 + [x] bevyengine#3478 + [x] bevyengine#3479 + [x] bevyengine#3480 + [x] bevyengine#3481 + [x] bevyengine#3482 + [x] bevyengine#3483 + [x] bevyengine#3484 + [x] bevyengine#3485 + [x] bevyengine#3486
1 parent 600ee7e commit 130953c

File tree

9 files changed

+25
-22
lines changed

9 files changed

+25
-22
lines changed
 

‎clippy.toml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
doc-valid-idents = ["sRGB", "NaN", "iOS", "glTF", "GitHub", "WebGPU"]

‎crates/bevy_app/src/plugin.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ pub trait Plugin: Any + Send + Sync {
1515
}
1616

1717
/// Type representing an unsafe function that returns a mutable pointer to a [`Plugin`].
18-
/// Used for dynamically loading plugins. See bevy_dynamic_plugin/src/loader.rs#dynamically_load_plugin
18+
/// Used for dynamically loading plugins. See
19+
/// `bevy_dynamic_plugin/src/loader.rs#dynamically_load_plugin`
1920
pub type CreatePlugin = unsafe fn() -> *mut dyn Plugin;

‎crates/bevy_asset/src/assets.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ impl<T: Asset> Debug for AssetEvent<T> {
4747

4848
/// Stores Assets of a given type and tracks changes to them.
4949
///
50-
/// Each asset is mapped by a unique [HandleId](crate::HandleId), allowing any [Handle](crate::Handle)
51-
/// with the same HandleId to access it. These assets remain loaded for as long as a Strong handle
52-
/// to that asset exists.
50+
/// Each asset is mapped by a unique [`HandleId`], allowing any [`Handle`] with the same
51+
/// [`HandleId`] to access it. These assets remain loaded for as long as a Strong handle to that
52+
/// asset exists.
5353
///
5454
/// To store a reference to an asset without forcing it to stay loaded, you can use a Weak handle.
55-
/// To make a Weak handle a Strong one, use [Assets::get_handle](crate::Assets::get_handle) or pass
56-
/// the Assets collection into the handle's [make_strong](crate::Handle::make_strong) method.
57-
///
58-
/// Remember, if there are no Strong handles for an asset (i.e. they have all been dropped), the asset
59-
/// will unload. Make sure you always have a Strong handle when you want to keep an asset loaded!
55+
/// To make a Weak handle a Strong one, use [`Assets::get_handle`] or pass the `Assets` collection
56+
/// into the handle's [`make_strong`](Handle::make_strong) method.
6057
///
58+
/// Remember, if there are no Strong handles for an asset (i.e. they have all been dropped), the
59+
/// asset will unload. Make sure you always have a Strong handle when you want to keep an asset
60+
/// loaded!
6161
#[derive(Debug)]
6262
pub struct Assets<T: Asset> {
6363
assets: HashMap<HandleId, T>,
@@ -92,7 +92,7 @@ impl<T: Asset> Assets<T> {
9292
/// Unless there exists another Strong handle for this asset, it's advised to use the returned
9393
/// Strong handle. Not doing so may result in the unexpected release of the asset.
9494
///
95-
/// See [set_untracked](Assets::set_untracked) for more info.
95+
/// See [`set_untracked`](Assets::set_untracked) for more info.
9696
#[must_use = "not using the returned strong handle may result in the unexpected release of the asset"]
9797
pub fn set<H: Into<HandleId>>(&mut self, handle: H, asset: T) -> Handle<T> {
9898
let id: HandleId = handle.into();
@@ -102,8 +102,8 @@ impl<T: Asset> Assets<T> {
102102

103103
/// Add/modify the asset pointed to by the given handle.
104104
///
105-
/// If an asset already exists with the given HandleId, it will be modified. Otherwise the new asset
106-
/// will be inserted.
105+
/// If an asset already exists with the given [`HandleId`], it will be modified. Otherwise the
106+
/// new asset will be inserted.
107107
///
108108
/// # Events
109109
/// * [`AssetEvent::Created`]: Sent if the asset did not yet exist with the given handle
@@ -124,7 +124,7 @@ impl<T: Asset> Assets<T> {
124124
/// Get the asset for the given handle.
125125
///
126126
/// This is the main method for accessing asset data from an [Assets] collection. If you need
127-
/// mutable access to the asset, use [get_mut](Assets::get_mut).
127+
/// mutable access to the asset, use [`get_mut`](Assets::get_mut).
128128
pub fn get<H: Into<HandleId>>(&self, handle: H) -> Option<&T> {
129129
self.assets.get(&handle.into())
130130
}
@@ -190,7 +190,7 @@ impl<T: Asset> Assets<T> {
190190
self.assets.iter_mut().map(|(k, v)| (*k, v))
191191
}
192192

193-
/// Get an iterator over all HandleIds in the collection.
193+
/// Get an iterator over all [`HandleId`]'s in the collection.
194194
pub fn ids(&self) -> impl Iterator<Item = HandleId> + '_ {
195195
self.assets.keys().cloned()
196196
}

‎crates/bevy_crevice/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
clippy::needless_update,
44
clippy::len_without_is_empty,
55
clippy::needless_range_loop,
6-
clippy::all
6+
clippy::all,
7+
clippy::doc_markdown
78
)]
89
/*!
910
[![GitHub CI Status](https://github.com/LPGhatguy/crevice/workflows/CI/badge.svg)](https://github.com/LPGhatguy/crevice/actions)

‎crates/bevy_internal/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub mod core_pipeline {
9494

9595
#[cfg(feature = "bevy_gilrs")]
9696
pub mod gilrs {
97-
//! Bevy interface with GilRs - Game Input Library for Rust to handle gamepad inputs
97+
//! Bevy interface with `GilRs` - "Game Input Library for Rust" - to handle gamepad inputs.
9898
pub use bevy_gilrs::*;
9999
}
100100

‎crates/bevy_render/src/options.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl Default for WgpuOptions {
5555
}
5656
}
5757

58-
/// Get a features/limits priority from the environment variable WGPU_OPTIONS_PRIO
58+
/// Get a features/limits priority from the environment variable `WGPU_OPTIONS_PRIO`
5959
pub fn options_priority_from_env() -> Option<WgpuOptionsPriority> {
6060
Some(
6161
match std::env::var("WGPU_OPTIONS_PRIO")

‎crates/bevy_transform/src/components/global_transform.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl GlobalTransform {
175175
self.rotation * Vec3::Z
176176
}
177177

178-
/// Equivalent to [`-local_z()`][[GlobalTransform::local_z]
178+
/// Equivalent to [`-local_z()`][GlobalTransform::local_z]
179179
#[inline]
180180
pub fn forward(&self) -> Vec3 {
181181
-self.local_z()

‎crates/bevy_window/src/window.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl Window {
256256
}
257257

258258
/// The requested window client area width in logical pixels from window
259-
/// creation or the last call to [set_resolution](Window::set_resolution).
259+
/// creation or the last call to [`set_resolution`](Window::set_resolution).
260260
///
261261
/// This may differ from the actual width depending on OS size limits and
262262
/// the scaling factor for high DPI monitors.
@@ -266,7 +266,7 @@ impl Window {
266266
}
267267

268268
/// The requested window client area height in logical pixels from window
269-
/// creation or the last call to [set_resolution](Window::set_resolution).
269+
/// creation or the last call to [`set_resolution`](Window::set_resolution).
270270
///
271271
/// This may differ from the actual width depending on OS size limits and
272272
/// the scaling factor for high DPI monitors.
@@ -403,7 +403,7 @@ impl Window {
403403
}
404404

405405
/// The window scale factor as reported by the window backend.
406-
/// This value is unaffected by scale_factor_override.
406+
/// This value is unaffected by [`scale_factor_override`](Window::scale_factor_override).
407407
#[inline]
408408
pub fn backend_scale_factor(&self) -> f64 {
409409
self.backend_scale_factor

‎tools/ci/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn main() {
1313

1414
// See if clippy has any complaints.
1515
// - Type complexity must be ignored because we use huge templates for queries
16-
cmd!("cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::type_complexity")
16+
cmd!("cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::type_complexity -W clippy::doc_markdown")
1717
.run()
1818
.expect("Please fix clippy errors in output above.");
1919

0 commit comments

Comments
 (0)
Please sign in to comment.