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

Add lint for builder pattern functions and deref impls to be marked #[inline] #4435

Merged
merged 5 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions crates/re_arrow_store/src/store_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub struct StoreEvent {
impl std::ops::Deref for StoreEvent {
type Target = StoreDiff;

#[inline]
fn deref(&self) -> &Self::Target {
&self.diff
}
Expand Down
2 changes: 2 additions & 0 deletions crates/re_renderer/src/line_strip_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ impl<'a> LineBatchBuilder<'a> {
}

/// Sets the picking object id for every element in the batch.
#[inline]
pub fn picking_object_id(mut self, picking_object_id: PickingLayerObjectId) -> Self {
self.batch_mut().picking_object_id = picking_object_id;
self
Expand Down Expand Up @@ -496,6 +497,7 @@ impl<'a> LineStripBuilder<'a> {
self
}

#[inline]
pub fn picking_instance_id(mut self, instance_id: PickingLayerInstanceId) -> Self {
self.picking_instance_id = instance_id;
self
Expand Down
2 changes: 2 additions & 0 deletions crates/re_renderer/src/point_cloud_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,14 @@ impl<'a> PointCloudBatchBuilder<'a> {
}

/// Adds (!) flags for this batch.
#[inline]
pub fn flags(mut self, flags: PointCloudBatchFlags) -> Self {
self.batch_mut().flags |= flags;
self
}

/// Sets the picking object id for the current batch.
#[inline]
pub fn picking_object_id(mut self, picking_object_id: PickingLayerObjectId) -> Self {
self.batch_mut().picking_object_id = picking_object_id;
self
Expand Down
1 change: 1 addition & 0 deletions crates/re_renderer/src/wgpu_resources/bind_group_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub struct GpuBindGroup {
impl std::ops::Deref for GpuBindGroup {
type Target = wgpu::BindGroup;

#[inline]
fn deref(&self) -> &Self::Target {
&self.resource.inner
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub struct StoredResource<Res> {
impl<Res> Deref for StoredResource<Res> {
type Target = Res;

#[inline]
fn deref(&self) -> &Self::Target {
&self.resource
}
Expand Down
8 changes: 8 additions & 0 deletions crates/re_sdk/src/recording_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ impl RecordingStreamBuilder {
/// If the `RERUN` environment variable is set, it will override this.
///
/// Set also: [`Self::enabled`].
#[inline]
pub fn default_enabled(mut self, default_enabled: bool) -> Self {
self.default_enabled = default_enabled;
self
Expand All @@ -152,6 +153,7 @@ impl RecordingStreamBuilder {
/// Setting this will ignore the `RERUN` environment variable.
///
/// Set also: [`Self::default_enabled`].
#[inline]
pub fn enabled(mut self, enabled: bool) -> Self {
self.enabled = Some(enabled);
self
Expand All @@ -166,6 +168,7 @@ impl RecordingStreamBuilder {
/// unique `RecordingId`s.
///
/// The default is to use a random `RecordingId`.
#[inline]
pub fn recording_id(mut self, recording_id: impl Into<String>) -> Self {
self.store_id = Some(StoreId::from_string(
StoreKind::Recording,
Expand All @@ -183,6 +186,7 @@ impl RecordingStreamBuilder {
/// unique [`StoreId`]s.
///
/// The default is to use a random [`StoreId`].
#[inline]
pub fn store_id(mut self, store_id: StoreId) -> Self {
self.store_id = Some(store_id);
self
Expand All @@ -191,25 +195,29 @@ impl RecordingStreamBuilder {
/// Specifies the configuration of the internal data batching mechanism.
///
/// See [`DataTableBatcher`] & [`DataTableBatcherConfig`] for more information.
#[inline]
pub fn batcher_config(mut self, config: DataTableBatcherConfig) -> Self {
self.batcher_config = Some(config);
self
}

#[doc(hidden)]
#[inline]
pub fn store_source(mut self, store_source: StoreSource) -> Self {
self.store_source = Some(store_source);
self
}

#[allow(clippy::wrong_self_convention)]
#[doc(hidden)]
#[inline]
pub fn is_official_example(mut self, is_official_example: bool) -> Self {
self.is_official_example = is_official_example;
self
}

#[doc(hidden)]
#[inline]
pub fn blueprint(mut self) -> Self {
self.store_kind = StoreKind::Blueprint;
self
Expand Down
6 changes: 6 additions & 0 deletions crates/re_types/src/archetypes/arrows3d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/re_types/src/archetypes/asset3d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/re_types/src/archetypes/bar_chart.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions crates/re_types/src/archetypes/boxes2d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions crates/re_types/src/archetypes/boxes3d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/re_types/src/archetypes/depth_image.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/re_types/src/archetypes/image.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions crates/re_types/src/archetypes/line_strips2d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading