Skip to content

Conversation

@digizeph
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings July 10, 2025 23:00
Copy link
Contributor

Copilot AI left a comment

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 updates the codebase to use Rust’s named format arguments (introduced in Rust 1.58) and bumps the tungstenite and tokio-tungstenite dependencies to version 0.27.0, adjusting related APIs and formatting calls accordingly.

  • Migrate format!("…{}", var) and println!("{}", var) to named format capture ("{var}") across the codebase.
  • Adapt WebSocket calls from write_message/read_message to send/read for the new tungstenite version.
  • Update MD5 API calls from compute() to finalize() and bump dependency versions in Cargo.toml.

Reviewed Changes

Copilot reviewed 37 out of 38 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/parser/utils.rs Converted format! calls to named captures
src/parser/rislive/mod.rs Switched write_message to send and inlined named format args
src/parser/rislive/messages/server/raw_bytes.rs Applied named format args
src/parser/rislive/error.rs Updated write! calls to named format capture
src/parser/mrt/mrt_record.rs Switched format! to named format capture
src/parser/mrt/messages/table_dump_v2/... Applied named format args
src/parser/parser/mod.rs Converted string concatenation to named format capture
src/parser/filter.rs Migrated all format! calls to named captures
src/parser/bmp/... Updated panic!/println! macros and named format usage
src/parser/bgp/... Updated format! calls to named captures
src/models/... Converted display tests to use named captures
src/lib.rs WebSocket send changes and named format usage
examples/... Adjusted WebSocket calls and print macros for named captures
benches/data_source.rs Replaced compute() with finalize() and updated hex formatting
Cargo.toml Bumped tungstenite/tokio-tungstenite to 0.27.0
Comments suppressed due to low confidence (6)

src/parser/rislive/mod.rs:27

  • [nitpick] The into() call is redundant here since msg is already a String. You can pass it directly as Message::Text(msg) to simplify the code.
    socket.send(Message::Text(msg.into())).unwrap();

examples/real-time-ris-live-websocket.rs:18

  • [nitpick] Calling into() on the result of to_json_string() is unnecessary because it already returns a String. You can write .send(Message::Text(msg.to_json_string())) directly.
        .send(Message::Text(msg.to_json_string().into()))

examples/real-time-ris-live-websocket-async.rs:18

  • [nitpick] The into() call is redundant on a String here; you can simplify this to .send(Message::Text(msg.to_json_string())).
        .send(Message::Text(msg.to_json_string().into()))

src/lib.rs:150

  • [nitpick] Since msg is already a String, the .into() call is superfluous. You can pass msg directly: Message::Text(msg).
    socket.send(Message::Text(msg.into())).unwrap();

benches/data_source.rs:65

  • [nitpick] Comparing a temporary String’s &str via .as_str() is unnecessary; you can directly compare the String and &str with ==, e.g., if format!("{computed_checksum:x}") == checksum.
            if format!("{computed_checksum:x}").as_str() == checksum {

benches/data_source.rs:78

  • [nitpick] You can simplify the comparison by omitting .as_str() and letting String compare directly to &str: if format!("{download_checksum:x}") != checksum.
                if format!("{download_checksum:x}").as_str() != checksum {

@codecov
Copy link

codecov bot commented Jul 10, 2025

Codecov Report

Attention: Patch coverage is 95.54795% with 13 lines in your changes missing coverage. Please review.

Project coverage is 93.71%. Comparing base (4f62050) to head (3c63d68).
Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
src/parser/mrt/messages/table_dump.rs 80.95% 4 Missing ⚠️
src/parser/rislive/mod.rs 92.30% 3 Missing ⚠️
src/parser/bgp/attributes/attr_14_15_nlri.rs 95.23% 2 Missing ⚠️
src/parser/utils.rs 95.23% 2 Missing ⚠️
src/models/bgp/community.rs 96.29% 1 Missing ⚠️
src/parser/bmp/messages/termination_message.rs 97.14% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #220      +/-   ##
==========================================
+ Coverage   93.36%   93.71%   +0.35%     
==========================================
  Files          67       67              
  Lines        7461     7625     +164     
==========================================
+ Hits         6966     7146     +180     
+ Misses        495      479      -16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@digizeph digizeph changed the title Update tungstenite for websocket examples Update dependencies, cargo clippy, increase test coverage Jul 10, 2025
digizeph added 2 commits July 10, 2025 16:45
remove two unnecessary allow lints:
- `needless_range_loop`
- `new_without_default`

add a new allow lint:
- `uninlined_format_args`: to allow `println!("{}", arg);`
@digizeph digizeph merged commit bf817dd into main Jul 11, 2025
6 checks passed
@digizeph digizeph deleted the chore/update-tungstenite branch July 11, 2025 03:09
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.

2 participants