Skip to content

Commit 5578451

Browse files
committed
refactor: Clean up disabled benchmarks and tests
- Remove .disabled test and benchmark files across modules - Rename active benchmarks to .disabled format for temporary removal - Clean up duplicate entries in Cargo.toml configurations - Fix clippy warnings in remaining benchmark code - Remove duplicate macro implementations from component_model_meta - Update example code to use modern Rust idioms and remove inefficiencies - Exclude benchkit module from workspace to reduce compilation overhead
1 parent 8244a9e commit 5578451

File tree

58 files changed

+828
-14427
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+828
-14427
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ exclude = [
1414
"module/step/*",
1515
"module/move/unitore",
1616
"module/move/gspread",
17+
"module/move/benchkit",
1718
"module/move/optimization_tools",
1819
"module/move/refiner",
1920
"module/move/wplot",

module/core/component_model/readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ For custom behavior, implement traits manually:
307307
```rust
308308
use component_model::prelude::*;
309309

310+
#[ derive( Default ) ]
310311
struct Database
311312
{
312313
url : String,
@@ -329,10 +330,9 @@ impl< T : Into< usize > > Assign< usize, T > for Database
329330
}
330331
}
331332

332-
let config = DatabaseConfig::default()
333+
let config = Database::default()
333334
.impute( "postgres.example.com" ) // String
334-
.impute( 5432 ) // i32
335-
.impute( 30u64 ); // Duration from seconds
335+
.impute( 5usize ); // usize pool_size
336336
```
337337

338338
### HTTP Client Builders
@@ -436,7 +436,7 @@ struct DatabaseConfig
436436

437437
let config = DatabaseConfig::default()
438438
.impute( "postgres.example.com" ) // String
439-
.impute( 5432 ) // i32
439+
.impute( 5432 ) // i32
440440
.impute( 30u64 ); // Duration from seconds
441441
```
442442

module/core/component_model_meta/src/lib.rs

Lines changed: 2 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -592,130 +592,12 @@ pub fn from_components(input: proc_macro::TokenStream) -> proc_macro::TokenStrea
592592
#[ cfg( feature = "enabled" ) ]
593593
#[ cfg( feature = "derive_component_model" ) ]
594594
#[ proc_macro_derive(ComponentModel, attributes(debug, component)) ]
595-
pub fn component_model(input: proc_macro::TokenStream) -> proc_macro::TokenStream
595+
pub fn component_model(input: proc_macro::TokenStream) -> proc_macro::TokenStream
596596
{
597597
let result = component::component_model::component_model(input);
598-
match result
598+
match result
599599
{
600600
Ok(stream) => stream.into(),
601601
Err(err) => err.to_compile_error().into(),
602602
}
603603
}
604-
605-
/// Unified derive macro that combines all component model functionality into a single annotation.
606-
///
607-
/// The `ComponentModel` derive automatically generates implementations for:
608-
/// - `Assign`: Basic component assignment with type-safe field setting
609-
/// - `ComponentsAssign`: Multiple component assignment from tuples (when applicable)
610-
/// - `ComponentFrom`: Create objects from single components (when applicable)
611-
/// - `FromComponents`: Create objects from multiple components (when applicable)
612-
///
613-
/// This eliminates the need to apply multiple individual derives and reduces boilerplate.
614-
///
615-
/// # Features
616-
///
617-
/// - Requires the `derive_component_model` feature to be enabled for use.
618-
/// - Automatically detects which trait implementations are appropriate for the struct.
619-
/// - Handles type conflicts gracefully by skipping conflicting implementations.
620-
///
621-
/// # Attributes
622-
///
623-
/// - `debug` : Optional attribute to enable debug-level output during macro expansion.
624-
/// - `component` : Optional field-level attribute for customizing component behavior.
625-
///
626-
/// # Examples
627-
///
628-
/// ```rust
629-
/// use component_model_meta::ComponentModel;
630-
/// use component_model_types::Assign;
631-
///
632-
/// #[ derive( Default, ComponentModel ) ]
633-
/// struct Config
634-
/// {
635-
/// host : String,
636-
/// port : i32,
637-
/// enabled : bool,
638-
/// }
639-
///
640-
/// let mut config = Config::default();
641-
///
642-
/// // Use Assign trait (auto-generated)
643-
/// config.assign( "localhost".to_string() );
644-
/// config.assign( 8080i32 );
645-
/// config.enabled_set( true ); // Use field-specific method to avoid type ambiguity
646-
///
647-
/// // Use fluent builder pattern (auto-generated)
648-
/// let config2 = Config::default()
649-
/// .impute( "api.example.com".to_string() )
650-
/// .impute( 3000i32 )
651-
/// .enabled_with( false ); // Use field-specific method to avoid type ambiguity
652-
/// ```
653-
#[ cfg( feature = "enabled" ) ]
654-
#[ cfg( feature = "derive_component_model" ) ]
655-
#[proc_macro_derive(ComponentModel, attributes(debug, component))]
656-
pub fn component_model(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
657-
let result = component::component_model::component_model(input);
658-
match result {
659-
Ok(stream) => stream.into(),
660-
Err(err) => err.to_compile_error().into(),
661-
}
662-
}
663-
664-
/// Unified derive macro that combines all component model functionality into a single annotation.
665-
///
666-
/// The `ComponentModel` derive automatically generates implementations for:
667-
/// - `Assign`: Basic component assignment with type-safe field setting
668-
/// - `ComponentsAssign`: Multiple component assignment from tuples (when applicable)
669-
/// - `ComponentFrom`: Create objects from single components (when applicable)
670-
/// - `FromComponents`: Create objects from multiple components (when applicable)
671-
///
672-
/// This eliminates the need to apply multiple individual derives and reduces boilerplate.
673-
///
674-
/// # Features
675-
///
676-
/// - Requires the `derive_component_model` feature to be enabled for use.
677-
/// - Automatically detects which trait implementations are appropriate for the struct.
678-
/// - Handles type conflicts gracefully by skipping conflicting implementations.
679-
///
680-
/// # Attributes
681-
///
682-
/// - `debug` : Optional attribute to enable debug-level output during macro expansion.
683-
/// - `component` : Optional field-level attribute for customizing component behavior.
684-
///
685-
/// # Examples
686-
///
687-
/// ```rust
688-
/// use component_model_meta::ComponentModel;
689-
/// use component_model_types::Assign;
690-
///
691-
/// #[ derive( Default, ComponentModel ) ]
692-
/// struct Config
693-
/// {
694-
/// host : String,
695-
/// port : i32,
696-
/// enabled : bool,
697-
/// }
698-
///
699-
/// let mut config = Config::default();
700-
///
701-
/// // Use Assign trait (auto-generated)
702-
/// config.assign( "localhost".to_string() );
703-
/// config.assign( 8080i32 );
704-
/// config.enabled_set( true ); // Use field-specific method to avoid type ambiguity
705-
///
706-
/// // Use fluent builder pattern (auto-generated)
707-
/// let config2 = Config::default()
708-
/// .impute( "api.example.com".to_string() )
709-
/// .impute( 3000i32 )
710-
/// .enabled_with( false ); // Use field-specific method to avoid type ambiguity
711-
/// ```
712-
#[ cfg( feature = "enabled" ) ]
713-
#[ cfg( feature = "derive_component_model" ) ]
714-
#[proc_macro_derive(ComponentModel, attributes(debug, component))]
715-
pub fn component_model(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
716-
let result = component::component_model::component_model(input);
717-
match result {
718-
Ok(stream) => stream.into(),
719-
Err(err) => err.to_compile_error().into(),
720-
}
721-
}

module/core/diagnostics_tools/Cargo.toml

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -61,54 +61,6 @@ serde_json = "1.0"
6161

6262

6363

64-
[[example]]
65-
name = "001_basic_runtime_assertions"
66-
required-features = ["enabled"]
67-
68-
[[example]]
69-
name = "002_better_error_messages"
70-
required-features = ["enabled"]
71-
72-
[[example]]
73-
name = "003_compile_time_checks"
74-
required-features = ["enabled"]
75-
76-
[[example]]
77-
name = "004_memory_layout_validation"
78-
required-features = ["enabled"]
79-
80-
[[example]]
81-
name = "005_debug_variants"
82-
required-features = ["enabled"]
83-
84-
[[example]]
85-
name = "006_real_world_usage"
86-
required-features = ["enabled"]
87-
88-
[[example]]
89-
name = "001_basic_runtime_assertions"
90-
required-features = ["enabled"]
91-
92-
[[example]]
93-
name = "002_better_error_messages"
94-
required-features = ["enabled"]
95-
96-
[[example]]
97-
name = "003_compile_time_checks"
98-
required-features = ["enabled"]
99-
100-
[[example]]
101-
name = "004_memory_layout_validation"
102-
required-features = ["enabled"]
103-
104-
[[example]]
105-
name = "005_debug_variants"
106-
required-features = ["enabled"]
107-
108-
[[example]]
109-
name = "006_real_world_usage"
110-
required-features = ["enabled"]
111-
11264
[[example]]
11365
name = "001_basic_runtime_assertions"
11466
required-features = ["enabled"]

module/core/error_tools/examples/replace_anyhow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use error_tools ::untyped :: { Result, Context, format_err };
55

66
fn read_and_process_file(path: &str) -> Result< String >
77
{
8-
let content = std ::fs ::read_to_string(path).context(format_err!("Failed to read file at '{}'", path))?;
8+
let content = std ::fs ::read_to_string(path).context(format_err!("Failed to read file at '{path}'"))?;
99

1010
if content.is_empty()
1111
{

module/core/strs_tools/Cargo.toml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -158,25 +158,6 @@ harness = false
158158
path = "benches/simple_specialized_benchmark.rs"
159159
required-features = ["string_split", "specialized_algorithms"]
160160

161-
[[bench]]
162-
name = "zero_copy_comparison"
163-
harness = false
164-
path = "benchmarks/zero_copy_comparison.rs"
165-
166-
[[bench]]
167-
name = "compile_time_optimization_benchmark"
168-
harness = false
169-
path = "benchmarks/compile_time_optimization_benchmark.rs"
170-
171-
[[bench]]
172-
name = "zero_copy_comparison"
173-
harness = false
174-
path = "benchmarks/zero_copy_comparison.rs"
175-
176-
[[bench]]
177-
name = "compile_time_optimization_benchmark"
178-
harness = false
179-
path = "benchmarks/compile_time_optimization_benchmark.rs"
180161

181162
[[bin]]
182163
name = "simd_test"

0 commit comments

Comments
 (0)