From e56685370ba82003af60a491667fac209a0f7897 Mon Sep 17 00:00:00 2001 From: Michael Dorst Date: Sun, 9 Jan 2022 11:09:46 +0000 Subject: [PATCH] Fix `doc_markdown` lints in `bevy_render` (#3479) #3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time. This PR fixes lints in the `bevy_render` crate. --- crates/bevy_render/src/color/mod.rs | 2 +- crates/bevy_render/src/mesh/mesh/conversions.rs | 2 +- crates/bevy_render/src/mesh/mesh/mod.rs | 14 +++++++------- crates/bevy_render/src/render_asset.rs | 2 +- crates/bevy_render/src/render_graph/edge.rs | 8 ++++---- crates/bevy_render/src/render_graph/node.rs | 2 +- crates/bevy_render/src/render_graph/node_slot.rs | 2 +- crates/bevy_render/src/render_phase/draw.rs | 2 +- crates/bevy_render/src/render_phase/draw_state.rs | 2 +- crates/bevy_render/src/render_resource/pipeline.rs | 4 ++-- crates/bevy_render/src/render_resource/texture.rs | 2 +- crates/bevy_render/src/renderer/render_device.rs | 2 +- crates/bevy_render/src/texture/image.rs | 2 +- 13 files changed, 23 insertions(+), 23 deletions(-) diff --git a/crates/bevy_render/src/color/mod.rs b/crates/bevy_render/src/color/mod.rs index 38ac48bce3..14cb8e8dba 100644 --- a/crates/bevy_render/src/color/mod.rs +++ b/crates/bevy_render/src/color/mod.rs @@ -381,7 +381,7 @@ impl Color { } } - /// Converts a `Color` to a `[f32; 4]` from sRBG colorspace + /// Converts a `Color` to a `[f32; 4]` from sRGB colorspace pub fn as_rgba_f32(self: Color) -> [f32; 4] { match self { Color::Rgba { diff --git a/crates/bevy_render/src/mesh/mesh/conversions.rs b/crates/bevy_render/src/mesh/mesh/conversions.rs index 9c33bb5dde..9bf4a55f76 100644 --- a/crates/bevy_render/src/mesh/mesh/conversions.rs +++ b/crates/bevy_render/src/mesh/mesh/conversions.rs @@ -1,5 +1,5 @@ //! These implementations allow you to -//! convert std::vec::Vec to VertexAttributeValues::T and back. +//! convert `std::vec::Vec` to `VertexAttributeValues::T` and back. //! //! # Examples //! diff --git a/crates/bevy_render/src/mesh/mesh/mod.rs b/crates/bevy_render/src/mesh/mesh/mod.rs index 0dc870f1bc..faba4b3a17 100644 --- a/crates/bevy_render/src/mesh/mesh/mod.rs +++ b/crates/bevy_render/src/mesh/mesh/mod.rs @@ -68,9 +68,9 @@ impl Mesh { /// Per vertex joint transform matrix index. Use in conjunction with [`Mesh::set_attribute`] pub const ATTRIBUTE_JOINT_INDEX: &'static str = "Vertex_JointIndex"; - /// Construct a new mesh. You need to provide a PrimitiveTopology so that the + /// Construct a new mesh. You need to provide a [`PrimitiveTopology`] so that the /// renderer knows how to treat the vertex data. Most of the time this will be - /// `PrimitiveTopology::TriangleList`. + /// [`PrimitiveTopology::TriangleList`]. pub fn new(primitive_topology: PrimitiveTopology) -> Self { Mesh { primitive_topology, @@ -269,7 +269,7 @@ impl Mesh { /// /// # Panics /// Panics if [`Indices`] are set or [`Mesh::ATTRIBUTE_POSITION`] is not of type `float3`. - /// Consider calling [Mesh::duplicate_vertices] or export your mesh with normal attributes. + /// Consider calling [`Mesh::duplicate_vertices`] or export your mesh with normal attributes. pub fn compute_flat_normals(&mut self) { if self.indices().is_some() { panic!("`compute_flat_normals` can't work on indexed geometry. Consider calling `Mesh::duplicate_vertices`."); @@ -404,8 +404,8 @@ pub enum VertexAttributeValues { } impl VertexAttributeValues { - /// Returns the number of vertices in this VertexAttribute. For a single - /// mesh, all of the VertexAttributeValues must have the same length. + /// Returns the number of vertices in this [`VertexAttributeValues`]. For a single + /// mesh, all of the [`VertexAttributeValues`] must have the same length. pub fn len(&self) -> usize { match *self { VertexAttributeValues::Float32(ref values) => values.len(), @@ -439,7 +439,7 @@ impl VertexAttributeValues { } } - /// Returns `true` if there are no vertices in this VertexAttributeValue. + /// Returns `true` if there are no vertices in this [`VertexAttributeValues`]. pub fn is_empty(&self) -> bool { self.len() == 0 } @@ -453,7 +453,7 @@ impl VertexAttributeValues { } // TODO: add vertex format as parameter here and perform type conversions - /// Flattens the VertexAttributeArray into a sequence of bytes. This is + /// Flattens the [`VertexAttributeValues`] into a sequence of bytes. This is /// useful for serialization and sending to the GPU. pub fn get_bytes(&self) -> &[u8] { match self { diff --git a/crates/bevy_render/src/render_asset.rs b/crates/bevy_render/src/render_asset.rs index 5c43cd7dcc..2140365207 100644 --- a/crates/bevy_render/src/render_asset.rs +++ b/crates/bevy_render/src/render_asset.rs @@ -27,7 +27,7 @@ pub trait RenderAsset: Asset { /// The GPU-representation of the the asset. type PreparedAsset: Send + Sync + 'static; /// Specifies all ECS data required by [`RenderAsset::prepare_asset`]. - /// For convenience use the [`lifetimeless`](bevy_ecs::system::lifetimeless) SystemParams. + /// For convenience use the [`lifetimeless`](bevy_ecs::system::lifetimeless) [`SystemParam`]. type Param: SystemParam; /// Converts the asset into a [`RenderAsset::ExtractedAsset`]. fn extract_asset(&self) -> Self::ExtractedAsset; diff --git a/crates/bevy_render/src/render_graph/edge.rs b/crates/bevy_render/src/render_graph/edge.rs index 37b1b9080c..bfb05eb04b 100644 --- a/crates/bevy_render/src/render_graph/edge.rs +++ b/crates/bevy_render/src/render_graph/edge.rs @@ -6,8 +6,8 @@ use super::NodeId; /// They are used to describe the ordering (which node has to run first) /// and may be of two kinds: [`NodeEdge`](Self::NodeEdge) and [`SlotEdge`](Self::SlotEdge). /// -/// Edges are added via the render_graph::add_node_edge(output_node, input_node) and the -/// render_graph::add_slot_edge(output_node, output_slot, input_node, input_slot) methods. +/// Edges are added via the `render_graph::add_node_edge(output_node, input_node)` and the +/// `render_graph::add_slot_edge(output_node, output_slot, input_node, input_slot)` methods. /// /// The former simply states that the `output_node` has to be run before the `input_node`, /// while the later connects an output slot of the `output_node` @@ -32,7 +32,7 @@ pub enum Edge { } impl Edge { - /// Returns the id of the 'input_node'. + /// Returns the id of the `input_node`. pub fn get_input_node(&self) -> NodeId { match self { Edge::SlotEdge { input_node, .. } => *input_node, @@ -40,7 +40,7 @@ impl Edge { } } - /// Returns the id of the 'output_node'. + /// Returns the id of the `output_node`. pub fn get_output_node(&self) -> NodeId { match self { Edge::SlotEdge { output_node, .. } => *output_node, diff --git a/crates/bevy_render/src/render_graph/node.rs b/crates/bevy_render/src/render_graph/node.rs index 0562cef87b..5c8c6ce39b 100644 --- a/crates/bevy_render/src/render_graph/node.rs +++ b/crates/bevy_render/src/render_graph/node.rs @@ -33,7 +33,7 @@ impl NodeId { /// /// Nodes are the fundamental part of the graph and used to extend its functionality, by /// generating draw calls and/or running subgraphs. -/// They are added via the render_graph::add_node(my_node) methode. +/// They are added via the `render_graph::add_node(my_node)` method. /// /// To determine their position in the graph and ensure that all required dependencies (inputs) /// are already executed, [`Edges`](Edge) are used. diff --git a/crates/bevy_render/src/render_graph/node_slot.rs b/crates/bevy_render/src/render_graph/node_slot.rs index 0789d62df0..471322c0db 100644 --- a/crates/bevy_render/src/render_graph/node_slot.rs +++ b/crates/bevy_render/src/render_graph/node_slot.rs @@ -4,7 +4,7 @@ use std::borrow::Cow; use crate::render_resource::{Buffer, Sampler, TextureView}; /// A value passed between render [`Nodes`](super::Node). -/// Corresponds to the [SlotType] specified in the [`RenderGraph`](super::RenderGraph). +/// Corresponds to the [`SlotType`] specified in the [`RenderGraph`](super::RenderGraph). /// /// Slots can have four different types of values: /// [`Buffer`], [`TextureView`], [`Sampler`] and [`Entity`]. diff --git a/crates/bevy_render/src/render_phase/draw.rs b/crates/bevy_render/src/render_phase/draw.rs index 0258ee6b4d..b21e65e468 100644 --- a/crates/bevy_render/src/render_phase/draw.rs +++ b/crates/bevy_render/src/render_phase/draw.rs @@ -110,7 +110,7 @@ impl DrawFunctions

{ } } -/// RenderCommand is a trait that runs an ECS query and produces one or more +/// [`RenderCommand`] is a trait that runs an ECS query and produces one or more /// [`TrackedRenderPass`] calls. Types implementing this trait can be composed (as tuples). /// /// They can be registered as a [`Draw`] function via the diff --git a/crates/bevy_render/src/render_phase/draw_state.rs b/crates/bevy_render/src/render_phase/draw_state.rs index c27f9bed5d..ec17b2902a 100644 --- a/crates/bevy_render/src/render_phase/draw_state.rs +++ b/crates/bevy_render/src/render_phase/draw_state.rs @@ -249,7 +249,7 @@ impl<'a> TrackedRenderPass<'a> { /// Set push constant data. /// - /// Features::PUSH_CONSTANTS must be enabled on the device in order to call these functions. + /// `Features::PUSH_CONSTANTS` must be enabled on the device in order to call these functions. pub fn set_push_constants(&mut self, stages: ShaderStages, offset: u32, data: &[u8]) { trace!( "set push constants: {:?} offset: {} data.len: {}", diff --git a/crates/bevy_render/src/render_resource/pipeline.rs b/crates/bevy_render/src/render_resource/pipeline.rs index f462c98c53..adeab97652 100644 --- a/crates/bevy_render/src/render_resource/pipeline.rs +++ b/crates/bevy_render/src/render_resource/pipeline.rs @@ -11,7 +11,7 @@ use wgpu::{ #[derive(Copy, Clone, Hash, Eq, PartialEq, Debug)] pub struct RenderPipelineId(Uuid); -/// A RenderPipeline represents a graphics pipeline and its stages (shaders), bindings and vertex buffers. +/// A [`RenderPipeline`] represents a graphics pipeline and its stages (shaders), bindings and vertex buffers. /// /// May be converted from and dereferences to a wgpu [`RenderPipeline`](wgpu::RenderPipeline). /// Can be created via [`RenderDevice::create_render_pipeline`](crate::renderer::RenderDevice::create_render_pipeline). @@ -50,7 +50,7 @@ impl Deref for RenderPipeline { #[derive(Copy, Clone, Hash, Eq, PartialEq, Debug)] pub struct ComputePipelineId(Uuid); -/// A ComputePipeline represents a compute pipeline and its single shader stage. +/// A [`ComputePipeline`] represents a compute pipeline and its single shader stage. /// /// May be converted from and dereferences to a wgpu [`ComputePipeline`](wgpu::ComputePipeline). /// Can be created via [`RenderDevice::create_compute_pipeline`](crate::renderer::RenderDevice::create_compute_pipeline). diff --git a/crates/bevy_render/src/render_resource/texture.rs b/crates/bevy_render/src/render_resource/texture.rs index 047c042123..4a7d582d75 100644 --- a/crates/bevy_render/src/render_resource/texture.rs +++ b/crates/bevy_render/src/render_resource/texture.rs @@ -51,7 +51,7 @@ impl Deref for Texture { pub struct TextureViewId(Uuid); /// This type combines wgpu's [`TextureView`](wgpu::TextureView) and -/// [SurfaceTexture`](wgpu::SurfaceTexture) into the same interface. +/// [`SurfaceTexture`](wgpu::SurfaceTexture) into the same interface. #[derive(Clone, Debug)] pub enum TextureViewValue { /// The value is an actual wgpu [`TextureView`](wgpu::TextureView). diff --git a/crates/bevy_render/src/renderer/render_device.rs b/crates/bevy_render/src/renderer/render_device.rs index 22dd807d7d..9135498bb0 100644 --- a/crates/bevy_render/src/renderer/render_device.rs +++ b/crates/bevy_render/src/renderer/render_device.rs @@ -35,7 +35,7 @@ impl RenderDevice { self.device.limits() } - /// Creates a [ShaderModule](wgpu::ShaderModule) from either SPIR-V or WGSL source code. + /// Creates a [`ShaderModule`](wgpu::ShaderModule) from either SPIR-V or WGSL source code. #[inline] pub fn create_shader_module(&self, desc: &wgpu::ShaderModuleDescriptor) -> wgpu::ShaderModule { self.device.create_shader_module(desc) diff --git a/crates/bevy_render/src/texture/image.rs b/crates/bevy_render/src/texture/image.rs index 29063905ae..1bb5e8935d 100644 --- a/crates/bevy_render/src/texture/image.rs +++ b/crates/bevy_render/src/texture/image.rs @@ -189,7 +189,7 @@ impl Image { } /// Load a bytes buffer in a [`Texture`], according to type `image_type`, using the `image` - /// crate` + /// crate pub fn from_buffer(buffer: &[u8], image_type: ImageType) -> Result { let format = match image_type { ImageType::MimeType(mime_type) => match mime_type {