Skip to content

[auto-fix] Attempt fixes from cargo/clippy#1465

Closed
github-actions[bot] wants to merge 1 commit into
mainfrom
auto-fix/24554191293
Closed

[auto-fix] Attempt fixes from cargo/clippy#1465
github-actions[bot] wants to merge 1 commit into
mainfrom
auto-fix/24554191293

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

This PR contains automatic fixes from cargo fix / clippy --fix / rustfmt applied by CI.
Run tests and review before merging.

@sourcery-ai

sourcery-ai Bot commented Apr 17, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR applies cargo-clippy and rustfmt-driven cleanups across meeting, calendar, EAS, EWS, and utility modules, replacing manual Default implementations with derive(Default), modernizing control-flow patterns, tightening iterator and matching logic, simplifying function signatures, and reflowing strings and formatting while preserving behavior.

Class diagram for updated meeting module types and defaults

classDiagram
    class MeetingMessageType {
        <<enumeration>>
        Request
        Update
        Response
        Cancellation
        Counter
        Forward
    }

    class AttendeeStatus {
        <<enumeration>>
        NeedsAction
        Accepted
        Declined
        Tentative
        Delegated
        NotResponded
    }

    class AttendeeRole {
        <<enumeration>>
        Required
        Optional
        Resource
    }

    class MeetingStatus {
        <<enumeration>>
        Appointment
        Organizer
        Tentative
        Accepted
        Declined
        Canceled
        Received
        ReceivedCanceled
    }

    class MeetingState {
        <<enumeration>>
        Draft
        RequestSent
        PendingResponses
        Confirmed
        Canceled
        Completed
    }

    class MeetingMessageGenerator {
        +generate_ical(msg : MeetingMessage) String
        +generate_eas_meeting_request(item : CalendarItem, _server_id : String) String
    }

    class MeetingMessage {
        +message_type : MeetingMessageType
    }

    class CaldavScheduling {
        +discover_scheduling_collections(username : String, password : String) SchedulingResult
        +send_meeting_request(item : CalendarItem, username : String, password : String) SchedulingResult
        +send_meeting_update(item : CalendarItem, sequence : i32, username : String, password : String) SchedulingResult
        +send_meeting_cancellation(item : CalendarItem, sequence : i32, username : String, password : String) SchedulingResult
        +send_meeting_response(uid : String, organizer_email : String, subject : String, start : DateTime_Utc, end : DateTime_Utc, status : AttendeeStatus, sequence : i32, username : String, password : String) SchedulingResult
    }

    class AttendeeTracker {
        +add_attendee(email : String, name : String, role : AttendeeRole) void
        +record_response(email : String, status : AttendeeStatus) Result
        +all_required_responded() bool
        +all_accepted() bool
        +any_declined() bool
        +response_summary() AttendeeSummary
    }

    class MeetingStateFlags {
        +from_raw(flags : u8) MeetingStateFlags
        +to_raw() u8
        +to_meeting_status(is_organizer : bool, response_type : u8) MeetingStatus
    }

    class MeetingContext {
        +uid : String
        +organizer_email : String
        +start : DateTime_Utc
        +end : DateTime_Utc
        +sequence : i32
    }

    class MeetingStateMachine {
        +new(ctx : MeetingContext) MeetingStateMachine
        +context() MeetingContext
        +send_request() Result
        +update_meeting(is_major_change : bool) Result
    }

    MeetingMessageGenerator ..> MeetingMessage : generates
    MeetingMessageGenerator ..> MeetingMessageType : uses
    CaldavScheduling ..> MeetingMessageGenerator : uses
    CaldavScheduling ..> AttendeeStatus : uses
    AttendeeTracker ..> AttendeeStatus : tracks
    AttendeeTracker ..> AttendeeRole : tracks
    MeetingStateFlags ..> MeetingStatus : converts_to
    MeetingStateMachine ..> MeetingContext : holds
    MeetingStateMachine ..> MeetingState : transitions
    MeetingStateMachine ..> MeetingStatus : derives_status
Loading

File-Level Changes

Change Details Files
Replace manual Default implementations on enums with #[derive(Default)] and explicit #[default] variants to satisfy clippy and simplify boilerplate.
  • MeetingMessageType, AttendeeStatus, AttendeeRole, MeetingStatus, and MeetingState now derive Default instead of implementing it manually.
  • Each enum’s default variant is marked with #[default] for clarity and to keep semantics unchanged.
src/meeting/message.rs
src/meeting/attendee.rs
src/meeting/state.rs
Apply rustfmt/clippy formatting and style improvements in meeting message generation and tests without altering behavior.
  • Reordered use imports for consistency.
  • Reformatted long format! calls and conditionals into multi-line style and used let-else and && let patterns where appropriate.
  • Simplified some if/else branches (e.g., Counter handling in generate_ical) and re-indented XML/ICS generation and tests for readability.
  • No semantic changes to ICS/XML output or test expectations.
src/meeting/message.rs
Modernize ical_parser helpers and related calendar utilities using clearer signatures, early returns, and match/if-let patterns.
  • Split overly long function signatures across lines and added small refactors like using strip_suffix, char arrays in find, and let-else style patterns.
  • Refactored parse_ical_datetime to reduce nesting and use combined conditions rather than deeply nested if blocks.
  • Updated parse_ical_duration_minutes to compute the sign once and return a single Ok branch.
  • Adjusted parse_ical_param and unescape helpers for minor clarity improvements.
  • Updated calendar.rs wrappers (extract_vtimezone_block, parse_duration_minutes) to be small free functions that call ical_parser equivalents.
src/ical_parser.rs
src/calendar.rs
Improve CalDAV scheduling request builders with formatted multi-line XML bodies and minor call-site cleanups.
  • Reformatted XML request bodies (PROPFIND, schedule, REPORT) with multi-line raw strings and trailing format args for readability.
  • Split chained async calls over multiple lines and added minor unwrap_or_else closures for outbox discovery.
  • Kept HTTP methods, headers, and payloads semantically identical.
src/meeting/scheduling.rs
Tidy attendee tracking logic and tests with minor iterator and formatting adjustments.
  • Made AttendeeRole and AttendeeStatus derive(Default) and removed manual Default impls.
  • Reformatted long assert_eq! calls and tracker setup in tests across multiple lines.
  • Simplified all_required_responded/all_accepted/any_declined to use more idiomatic iter().all()/any() expressions.
  • Simplified load_from_records to use first().map(...).unwrap_or_default().
src/meeting/attendee.rs
Adjust meeting state types and state machine helpers for clippy compliance and readability.
  • MeetingStatus and MeetingState now derive(Default) instead of using manual impls.
  • Split to_meeting_status and MeetingContext::new signatures over multiple lines and normalized whitespace.
  • No changes to state machine transitions or semantics.
src/meeting/state.rs
General rustfmt/clippy cleanups across config, main, storage, EAS, EWS, calendar parsing, meeting module exports, util, and tests.
  • Re-flowed long error messages and format! calls across multiple lines for readability in config and CalDAV-related code.
  • Simplified some match arms to use guard patterns (e.g., MeetingResponse validation, parse_eas_sync_mutations logic).
  • Made small iterator improvements like zipping directly with freebusy_results instead of into_iter(), and using match guards instead of nested ifs.
  • Reordered pub mod declarations and pub use exports in meeting/mod.rs for consistency.
  • Compactified or expanded vec! and struct initialization in tests as per rustfmt and clippy suggestions.
  • Minor XML fixture and snapshot test whitespace normalization; no fixture contents changed semantically.
  • Removed a stray blank line in sync.rs and minor formatting tweaks in util.rs, ews.rs, protocol_fixtures.rs, storage.rs, lib.rs, snapshot_tests.rs.
src/main.rs
src/storage.rs
src/eas.rs
src/config.rs
src/meeting/mod.rs
src/util.rs
src/ews.rs
src/protocol_fixtures.rs
src/lib.rs
src/calendar.rs
tests/snapshot_tests.rs
src/sync.rs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@kilo-code-bot

kilo-code-bot Bot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Kilo Code Review could not run — your account is out of credits.

Add credits or switch to a free model to enable reviews on this change.

@deepsource-io

deepsource-io Bot commented Apr 17, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in a16fa7d...2e85b93 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Rust Apr 17, 2026 7:19p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@ai-coding-guardrails ai-coding-guardrails Bot 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.

I've got 1 comment for you to consider

Reviewed with 🤟 by Zenable

Comment thread src/meeting/message.rs
Comment on lines +279 to +281
} else if msg.message_type == MeetingMessageType::Counter
&& let (Some(start), Some(end)) = (msg.proposed_start, msg.proposed_end)
{

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.

The refactoring of the Counter branch changes the logic semantics. The original code was:

} else if msg.message_type == MeetingMessageType::Counter {
    if let (Some(start), Some(end)) = (msg.proposed_start, msg.proposed_end) {
        // emit DTSTART/DTEND
    }
}

The new code uses && let (a let chain), which means if message_type == Counter but proposed_start/proposed_end are None, the entire else if arm is skipped and falls through — whereas the original would still enter the Counter branch (just without emitting the lines). While the observable output is the same here (no lines emitted either way), this is only valid on nightly or Rust ≥ 1.88 (stabilized in RFC 2497). If the MSRV is below 1.88, this will fail to compile. Verify the project's MSRV before accepting this change.

Why did I show this?

Category: mistake
Comment Quality: high

Based on general best practices

Tools used:

  1. get_file_lines, {'file_path': 'src/calendar.rs', 'start_line': '1', 'end_line': '200'}
  2. get_file_lines, {'file_path': 'src/meeting/attendee.rs', 'start_line': '1', 'end_line': '200'}
  3. get_file_lines, {'file_path': 'src/util.rs', 'start_line': '1', 'end_line': '200'}

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 19 files

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/ical_parser.rs" line_range="191" />
<code_context>
+    )))
 }

 pub fn parse_ical_param(input: &str, param_name: &str) -> Option<String> {
</code_context>
<issue_to_address>
**suggestion (bug_risk):** `parse_ical_param` is strictly case-sensitive, which may miss valid iCalendar parameters.

Per the iCalendar spec, parameter names are case-insensitive, but this function looks for an exact `";{param_name}="` match. If upstream sends `TZID` while we search for `tzid`, parsing will fail silently. Consider normalizing both `input` and `param_name` to a common case for the search, while still returning the original slice, to handle mixed-case producers correctly.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/ical_parser.rs
)))
}

pub fn parse_ical_param(input: &str, param_name: &str) -> Option<String> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (bug_risk): parse_ical_param is strictly case-sensitive, which may miss valid iCalendar parameters.

Per the iCalendar spec, parameter names are case-insensitive, but this function looks for an exact ";{param_name}=" match. If upstream sends TZID while we search for tzid, parsing will fail silently. Consider normalizing both input and param_name to a common case for the search, while still returning the original slice, to handle mixed-case producers correctly.

@llamapreview llamapreview Bot 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.

AI Code Review by LlamaPReview

🎯 TL;DR & Recommendation

Recommendation: Approve with suggestions.
This auto-fix PR applies clippy and rustfmt suggestions across multiple files, introducing stylistic and maintainability improvements without critical runtime issues.

🌟 Strengths

  • Enhances code readability and adherence to Rust best practices through idiomatic patterns.
  • Reduces boilerplate by using derived Default implementations, improving consistency.
Priority File Category Impact Summary Anchors
P2 src/ical_parser.rs Architecture Changes if-let pattern; could affect debugging and future modifications. extract_vtimezone_block, src/calendar.rs
P2 src/meeting/attendee.rs Maintainability Replaces manual impl Default with derive for enums, reducing boilerplate. AttendeeStatus, src/meeting/message.rs, src/meeting/state.rs
P2 src/eas.rs Maintainability Refactors match arm to use guard for clearer validation logic.
P2 src/ical_parser.rs Maintainability Uses strip_suffix for Z-suffix handling, making code more idiomatic. parse_ical_datetime
P2 src/main.rs Maintainability Stylistic import reordering; potential merge conflicts but no functional impact.

🔍 Notable Themes

  • The changes are driven by clippy lints, standardizing code patterns and promoting idiomatic Rust across the codebase without altering functionality.

💡 Have feedback? We'd love to hear it in our GitHub Discussions.
✨ This review was generated by LlamaPReview Advanced, which is free for all open-source projects. Learn more.

Comment thread src/meeting/attendee.rs
Comment on lines +6 to 14
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Default)]
pub enum AttendeeStatus {
#[default]
NeedsAction = 0,
Accepted = 1,
Declined = 2,
Tentative = 3,
NotResponded = 5,
}

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.

P2 | Confidence: High

The PR replaces explicit impl Default blocks with #[derive(Default)] and #[default] attributes across multiple enums (AttendeeStatus, AttendeeRole, MeetingMessageType, MeetingStatus, MeetingState). This is a maintainability improvement that reduces boilerplate. The related_context confirms these enums are used in src/meeting/message.rs and src/meeting/state.rs. The change is safe because the derived Default implementation selects the variant marked with #[default], which matches the previous manual implementations (e.g., NeedsAction for AttendeeStatus). This standardization improves consistency and reduces the risk of future manual implementation errors.

Comment thread src/eas.rs
Comment on lines +303 to 305
"meetingresponse" if extract_first_tag_text(xml, b"UserResponse").is_none() => {
return Err("MeetingResponse requires UserResponse");
}

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.

P2 | Confidence: High

The PR refactors a match arm for the "meetingresponse" command by moving the validation condition into a match guard. Previously, it was a separate if statement inside the arm. This change improves code clarity by consolidating the condition directly in the pattern. The logic remains identical: if the UserResponse tag is missing, an error is returned. This is a pure readability improvement with no impact on functionality or performance.

Comment thread src/ical_parser.rs
Comment on lines +157 to 164
if let Some(inner) = input.strip_suffix('Z') {
if let Ok(dt) = NaiveDateTime::parse_from_str(inner, "%Y%m%dT%H%M%S") {
return Ok(dt.and_utc());
}
if let Ok(dt) = NaiveDateTime::parse_from_str(inner, "%Y-%m-%dT%H:%M:%S") {
return Ok(dt.and_utc());
}
}

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.

P2 | Confidence: High

The PR updates parse_ical_datetime to use strip_suffix instead of checking input.ends_with('Z') and manually slicing. This is a modern, idiomatic Rust improvement that makes the intent clearer and reduces the chance of off-by-one errors. The function's behavior is unchanged: it attempts to parse a UTC datetime string with a trailing 'Z'. The change aligns with Rust best practices and improves code readability without affecting the parsing logic or error paths.

Comment thread src/ical_parser.rs
}

pub fn parse_vtimezone_block(input: &str) -> Result<Option<String>, nom::Err<nom::error::Error<&str>>> {
pub fn parse_vtimezone_block(

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.

P2 | Confidence: Medium

The PR converts a simple two-step if let pattern into a single if let chain with &&. While this is a stylistic improvement suggested by clippy, it changes the control flow in a critical parsing function. The related_context shows this function is called by extract_vtimezone_block in src/calendar.rs (line 449). The change doesn't affect correctness, but it subtly alters the evaluation order: both find() calls now execute within the same if expression rather than as sequential checks. This could affect debugging and potential future modifications where side effects might be added. The architectural impact is minimal but introduces a slightly different pattern than used elsewhere in the codebase.

Suggested change
pub fn parse_vtimezone_block(
pub fn parse_vtimezone_block(
input: &str,
) -> Result<Option<String>, nom::Err<nom::error::Error<&str>>> {
let unfolded = unfold_ical_content(input);
if let Some(start) = unfolded.find("BEGIN:VTIMEZONE") {
if let Some(end) = unfolded.find("END:VTIMEZONE") {
let block = &unfolded[start..end + "END:VTIMEZONE".len()];
return Ok(Some(block.to_string()));
}
}
Ok(None)
}

Evidence: method:extract_vtimezone_block, path:src/calendar.rs

Comment thread src/main.rs
@@ -84,7 +77,7 @@ async fn main() -> anyhow::Result<()> {
// Initialize OpenTelemetry if OTEL_EXPORTER_OTLP_ENDPOINT is set

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.

P2 | Confidence: Medium

Speculative: The PR includes significant formatting changes in src/main.rs, including reordering imports and restructuring the init_telemetry function. While these are purely stylistic (rustfmt and clippy suggestions), the reordering of imports (opentelemetry and tower_http items) could potentially introduce merge conflicts with other active branches that modify the same lines. However, the functional behavior of the telemetry initialization appears unchanged. The conditional tracing setup logic remains correct.

Base automatically changed from feature/meeting-workflow-implementation to main April 17, 2026 19:18
@Voornaamenachternaam Voornaamenachternaam deleted the auto-fix/24554191293 branch April 17, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant