Skip to content

[Clippy] Fix clippy issues in examples code#1293

Merged
weihanglo merged 13 commits into
rust-lang:mainfrom
DanielEScherzer:clippy-fixes-examples
Jul 16, 2026
Merged

[Clippy] Fix clippy issues in examples code#1293
weihanglo merged 13 commits into
rust-lang:mainfrom
DanielEScherzer:clippy-fixes-examples

Conversation

@DanielEScherzer

Copy link
Copy Markdown
Contributor

Commits are split by file and lint for ease of review.

Covers the code in the examples/ directory.

None of the issues required keeping the old code with an #[expect] attribute, they could all be fixed.

…les/add.rs

Simplify `run()` to remove the needless borrow.
Simplify `run()` to remove the explicit dereferences.
Simplify `print()` to use `checked_div()`.
Simplify `print_stats()` to remove the explicit dereference.
…les/diff.rs

Simplify `run()` to remove the needless borrows.
Simplify `resolve_blob()` to use the tuple variant `Some` rather than using a
closure.
Simplify `parse_shared()` using `str::strip_prefix()`.
Simplify `run()` using `str::strip_prefix()`.
…ff.rs

Simplify `log_message_matches()` to remove the needless borrow.
Simplify `do_merge()` and `run()` to remove the needless borrows.
Simplify `do_fetch()` to avoid wrapping the result of `?` in an `Ok()`, just
return the result from `Repository::reference_to_annotated_commit()` directly.
Simplify `run()` using `str::strip_prefix()`.
Simplify `run()` to remove the explicit dereference.
@rustbot rustbot added the S-waiting-on-review Status: Waiting on review label Jul 16, 2026

@weihanglo weihanglo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is great. Thanks for all the cleanup!

View changes since this review

@weihanglo
weihanglo added this pull request to the merge queue Jul 16, 2026
Merged via the queue into rust-lang:main with commit 02319cb Jul 16, 2026
11 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Waiting on review label Jul 16, 2026
@DanielEScherzer
DanielEScherzer deleted the clippy-fixes-examples branch July 16, 2026 16:39
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.

3 participants