Skip to content

Commit

Permalink
lints
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Jan 7, 2025
1 parent dad76ae commit 729cd9a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/store/re_types_core/src/as_components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::{
///
/// [IDL definitions]: https://github.com/rerun-io/rerun/tree/latest/crates/store/re_types/definitions/rerun
/// [Custom Data Loader]: https://github.com/rerun-io/rerun/blob/latest/examples/rust/custom_data_loader
/// [`Component`]: [crate::Component]
pub trait AsComponents {
/// Exposes the object's contents as a set of [`ComponentBatch`]s.
///
Expand All @@ -40,6 +41,8 @@ pub trait AsComponents {
///
/// The default implementation will simply serialize the result of [`Self::as_component_batches`]
/// as-is, which is what you want in 99.9% of cases.
///
/// [`Component`]: [crate::Component]
#[inline]
fn to_arrow2(
&self,
Expand Down Expand Up @@ -215,13 +218,15 @@ impl AsComponents for Vec<Box<dyn AsComponents>> {
/// let _ = (&comp as &dyn re_types_core::AsComponents).as_component_batches();
/// ```
#[allow(dead_code)]
#[allow(rustdoc::private_doc_tests)] // doc-tests are the only way to assert failed compilation
fn single_ascomponents() {}

/// ```compile_fail
/// let comp = re_types_core::components::ClearIsRecursive::default();
/// let _ = (&[comp] as &dyn re_types_core::AsComponents).as_component_batches();
/// ```
#[allow(dead_code)]
#[allow(rustdoc::private_doc_tests)] // doc-tests are the only way to assert failed compilation
fn single_ascomponents_wrapped() {
// This is non-sense (and more importantly: dangerous): a single component shouldn't be able to
// autocast straight to a collection of batches.
Expand All @@ -232,6 +237,7 @@ fn single_ascomponents_wrapped() {
/// let _ = (&[comp, comp, comp] as &dyn re_types_core::AsComponents).as_component_batches();
/// ```
#[allow(dead_code)]
#[allow(rustdoc::private_doc_tests)] // doc-tests are the only way to assert failed compilation
fn single_ascomponents_wrapped_many() {
// This is non-sense (and more importantly: dangerous): a single component shouldn't be able to
// autocast straight to a collection of batches.
Expand All @@ -243,6 +249,7 @@ fn single_ascomponents_wrapped_many() {
/// let _ = (&comps as &dyn re_types_core::AsComponents).as_component_batches();
/// ```
#[allow(dead_code)]
#[allow(rustdoc::private_doc_tests)] // doc-tests are the only way to assert failed compilation
fn many_ascomponents() {}

/// ```compile_fail
Expand All @@ -251,6 +258,7 @@ fn many_ascomponents() {}
/// let _ = (&[comps] as &dyn re_types_core::AsComponents).as_component_batches();
/// ```
#[allow(dead_code)]
#[allow(rustdoc::private_doc_tests)] // doc-tests are the only way to assert failed compilation
fn many_ascomponents_wrapped() {}

/// ```compile_fail
Expand All @@ -259,6 +267,7 @@ fn many_ascomponents_wrapped() {}
/// let _ = (&[comps] as &dyn re_types_core::ComponentBatch).to_arrow();
/// ```
#[allow(dead_code)]
#[allow(rustdoc::private_doc_tests)] // doc-tests are the only way to assert failed compilation
fn many_componentbatch_wrapped() {}

/// ```compile_fail
Expand All @@ -267,6 +276,7 @@ fn many_componentbatch_wrapped() {}
/// let _ = (&[comps.clone(), comps.clone(), comps.clone()] as &dyn re_types_core::AsComponents).as_component_batches();
/// ```
#[allow(dead_code)]
#[allow(rustdoc::private_doc_tests)] // doc-tests are the only way to assert failed compilation
fn many_ascomponents_wrapped_many() {}

/// ```compile_fail
Expand All @@ -275,6 +285,7 @@ fn many_ascomponents_wrapped_many() {}
/// let _ = (&[comps.clone(), comps.clone(), comps.clone()] as &dyn re_types_core::ComponentBatch).to_arrow();
/// ```
#[allow(dead_code)]
#[allow(rustdoc::private_doc_tests)] // doc-tests are the only way to assert failed compilation
fn many_componentbatch_wrapped_many() {}

#[cfg(test)]
Expand Down

0 comments on commit 729cd9a

Please sign in to comment.