Skip to content

Resolve clippy type_complexity warnings in geophysical config prompts#219

Merged
jbrodovsky merged 2 commits into
mainfrom
copilot/simplify-geophysical-config
Jan 9, 2026
Merged

Resolve clippy type_complexity warnings in geophysical config prompts#219
jbrodovsky merged 2 commits into
mainfrom
copilot/simplify-geophysical-config

Conversation

Copilot AI commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

Clippy flagged the return types of prompt_gravity_config() and prompt_magnetic_config() as excessively complex: Option<(GeoResolution, Option<f64>, Option<f64>, Option<String>)>.

Changes

  • Added GeoMeasurementConfig type alias to represent the tuple structure
  • Updated function signatures to use the new type alias
  • Documented each tuple field (resolution, bias, noise std dev, map file path)
/// Type alias for geophysical measurement configuration returned by prompt functions.
///
/// Contains:
/// - `GeoResolution`: The map resolution to use
/// - `Option<f64>`: Measurement bias (mGal for gravity, nT for magnetic)
/// - `Option<f64>`: Measurement noise standard deviation
/// - `Option<String>`: Map file path (auto-detected if None)
type GeoMeasurementConfig = (
    strapdown::sim::GeoResolution,
    Option<f64>,
    Option<f64>,
    Option<String>,
);

fn prompt_gravity_config() -> Option<GeoMeasurementConfig> { /* ... */ }
fn prompt_magnetic_config() -> Option<GeoMeasurementConfig> { /* ... */ }

The type alias is a zero-cost abstraction that preserves existing tuple destructuring patterns in calling code.

Original prompt

This section details on the original issue you should resolve

<issue_title>Simplify the geophysical config propmting functions.</issue_title>
<issue_description>Clippy lint gives the following suggestions:

warning: very complex type used. Consider factoring parts into `type` definitions
    --> sim/src/main.rs:1460:31
     |
1460 |   fn prompt_gravity_config() -> Option<(
     |  _______________________________^
1461 | |     strapdown::sim::GeoResolution,
1462 | |     Option<f64>,
1463 | |     Option<f64>,
1464 | |     Option<String>,
1465 | | )> {
     | |__^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.91.0/index.html#type_complexity
     = note: `#[warn(clippy::type_complexity)]` on by default

warning: very complex type used. Consider factoring parts into `type` definitions
    --> sim/src/main.rs:1526:32
     |
1526 |   fn prompt_magnetic_config() -> Option<(
     |  ________________________________^
1527 | |     strapdown::sim::GeoResolution,
1528 | |     Option<f64>,
1529 | |     Option<f64>,
1530 | |     Option<String>,
1531 | | )> {
     | |__^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.91.0/index.html#type_complexity

Please address these suggestions to improve code readability and maintainability.

Instructions:

  • Only modify the following files: sim/src/main.rs; sim/src/common.rs; core/src/sim.rs. If your plan should involve changes to other files, please explain why in the issue body.

Acceptence criteria:

  • The clippy warnings about complex types in sim/src/main.rs should be resolved.
  • The code should remain functionally equivalent after the changes.
  • The changes should be well-documented with comments explaining the new type definitions.
  • All tests should pass successfully after the modifications.

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: jbrodovsky <57160841+jbrodovsky@users.noreply.github.com>
Copilot AI changed the title [WIP] Simplify geophysical config prompting functions Resolve clippy type_complexity warnings in geophysical config prompts Jan 9, 2026
Copilot AI requested a review from jbrodovsky January 9, 2026 17:20
@jbrodovsky
jbrodovsky marked this pull request as ready for review January 9, 2026 19:36
Copilot AI review requested due to automatic review settings January 9, 2026 19:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR resolves clippy type_complexity warnings by introducing a type alias for complex tuple return types in geophysical configuration prompt functions.

  • Adds GeoMeasurementConfig type alias to simplify function signatures
  • Updates prompt_gravity_config() and prompt_magnetic_config() to use the new type alias
  • Includes comprehensive documentation explaining each tuple field

@jbrodovsky
jbrodovsky merged commit dd0777f into main Jan 9, 2026
7 checks passed
@jbrodovsky
jbrodovsky deleted the copilot/simplify-geophysical-config branch January 9, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify the geophysical config propmting functions.

3 participants