Skip to content

workspace: replace map().unwrap_or() with map_or() across codebase#12877

Merged
dan-starkware merged 1 commit intomain-v0.14.2from
02-26-workspace_replace_map_.unwrap_or_with_map_or_across_codebase
Mar 10, 2026
Merged

workspace: replace map().unwrap_or() with map_or() across codebase#12877
dan-starkware merged 1 commit intomain-v0.14.2from
02-26-workspace_replace_map_.unwrap_or_with_map_or_across_codebase

Conversation

@dan-starkware
Copy link
Copy Markdown
Collaborator

No description provided.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

@dan-starkware dan-starkware marked this pull request as ready for review February 26, 2026 08:52
Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@dan-starkware
Copy link
Copy Markdown
Collaborator Author

crates/starknet_committer_cli/src/commands.rs line 497 at r1 (raw file):

                &format!("{}.csv", block_number + 1),
                output_dir,
                storage_stats.as_ref().ok().map(|s| s.column_values()),

@liorgold2 note - these were Result not Option

Code quote:

 storage_stats.as_ref().ok().map(|s| s.column_values()),

Copy link
Copy Markdown
Contributor

@liorgold2 liorgold2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liorgold2 reviewed 9 files and all commit messages, and made 3 comments.
Reviewable status: 9 of 11 files reviewed, 4 unresolved discussions (waiting on dan-starkware).


crates/apollo_class_manager/src/class_manager.rs line 88 at r1 (raw file):

            compiled_class_hash = %executable_class_hash_v2,
            compilation_elapsed_ms = compilation_start_time.elapsed().as_millis(),
            class_size_bytes = class.size().map_or("Failed to get class size".to_owned(), |size| size.to_string()),

These lines are more than 100 characters. Don't we have a linter for this?


crates/apollo_consensus_orchestrator/src/sequencer_consensus_context.rs line 768 at r1 (raw file):

        round: Round,
    ) -> Result<(), ConsensusError> {
        if self.current_height.map_or(true, |h| height > h) {

Add a comment above the if explaining the condition.


crates/bench_tools/src/runner.rs line 139 at r1 (raw file):

    for bench in benchmarks {
        let benchmark_names: Vec<&str> =
            bench.criterion_benchmark_names.map(|names| names.to_vec()).unwrap_or(vec![bench.name]);

What's the type of names?

Copy link
Copy Markdown
Contributor

@liorgold2 liorgold2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liorgold2 reviewed 2 files.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on dan-starkware).

@dan-starkware dan-starkware force-pushed the 02-26-workspace_replace_map_.unwrap_or_with_map_or_across_codebase branch from b459802 to be02b48 Compare February 26, 2026 14:04
Copy link
Copy Markdown
Collaborator Author

@dan-starkware dan-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dan-starkware made 3 comments, resolved 1 discussion, and dismissed @liorgold2 from a discussion.
Reviewable status: 7 of 11 files reviewed, 3 unresolved discussions (waiting on liorgold2).


crates/apollo_class_manager/src/class_manager.rs line 88 at r1 (raw file):

Previously, liorgold2 wrote…

These lines are more than 100 characters. Don't we have a linter for this?

We do


crates/apollo_consensus_orchestrator/src/sequencer_consensus_context.rs line 768 at r1 (raw file):

Previously, liorgold2 wrote…

Add a comment above the if explaining the condition.

Done.


crates/bench_tools/src/runner.rs line 139 at r1 (raw file):

Previously, liorgold2 wrote…

What's the type of names?

bench.name: &'static str,
/// Optional list of Criterion benchmark names that this benchmark suite produces.
/// If None, assumes a single benchmark with the same name as the config.
/// Used for regression checking to know which criterion directories to check.
bench.criterion_benchmark_names: Option<&'static \[&'static str\]>,

Copy link
Copy Markdown
Collaborator Author

@dan-starkware dan-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dan-starkware resolved 1 discussion.
Reviewable status: 7 of 11 files reviewed, 2 unresolved discussions (waiting on liorgold2).

Copy link
Copy Markdown
Contributor

@liorgold2 liorgold2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@liorgold2 reviewed 4 files and all commit messages, made 1 comment, and resolved 2 discussions.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on dan-starkware).

@dan-starkware dan-starkware added this pull request to the merge queue Mar 10, 2026
Merged via the queue into main-v0.14.2 with commit 69763af Mar 10, 2026
26 of 33 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants