Enable Cargo Clippy pedantic linting rules#57
Conversation
📝 WalkthroughWalkthroughThis PR modernizes code style and lints across the Rust codebase: adds Clippy lint configuration, converts several async logger/init functions to synchronous, adds many #[must_use] annotations, simplifies control-flow patterns (let-else, map_or), makes small API/derive changes (Copy on enum, IntoIterator impl, private LyricsResponse), and minor formatting/test adjustments. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45–60 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (7)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/spotify/mod.rs (1)
199-206: Missing HTML escaping creates potential XSS vulnerability.
track_tg_linkcorrectly escapes the name usinghtml::escape(), butalbum_tg_linkoutputsalbum_name()raw. Album names from Spotify can contain special characters (&,<,>, quotes) that will break HTML rendering or potentially allow injection in Telegram messages.🔎 Proposed fix
#[must_use] pub fn album_tg_link(&self) -> String { format!( r#"<a href="{link}">{name}</a>"#, - name = self.album_name(), + name = html::escape(self.album_name()), link = self.album_url() ) }
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (50)
Cargo.tomlsrc/app.rssrc/cli/users.rssrc/entity/mod.rssrc/entity/spotify_auth.rssrc/entity/track_status.rssrc/entity/user.rssrc/infrastructure/error_handler.rssrc/infrastructure/logger.rssrc/lyrics/genius.rssrc/lyrics/lrclib.rssrc/lyrics/musixmatch.rssrc/lyrics/utils.rssrc/main.rssrc/metrics/influx.rssrc/metrics/mod.rssrc/profanity.rssrc/queue/profanity_check.rssrc/services/notification.rssrc/services/user.rssrc/spotify/auth.rssrc/spotify/mod.rssrc/telegram/actions/admin_users/details.rssrc/telegram/actions/admin_users/list.rssrc/telegram/actions/analyze.rssrc/telegram/actions/broadcast.rssrc/telegram/actions/details.rssrc/telegram/actions/dislike.rssrc/telegram/actions/global_stats.rssrc/telegram/actions/language.rssrc/telegram/actions/like.rssrc/telegram/actions/magic.rssrc/telegram/actions/recommendasion.rssrc/telegram/actions/start.rssrc/telegram/actions/word_definition.rssrc/telegram/commands.rssrc/telegram/handlers/keyboards.rssrc/telegram/handlers/url.rssrc/telegram/inline_buttons.rssrc/telegram/inline_buttons_admin.rssrc/telegram/keyboards.rssrc/telegram/utils.rssrc/tick/mod.rssrc/user.rssrc/utils/general.rssrc/utils/serde.rssrc/workers/bot.rssrc/workers/queues.rssrc/workers/server.rssrc/workers/track_check.rs
💤 Files with no reviewable changes (3)
- src/main.rs
- src/entity/spotify_auth.rs
- src/entity/mod.rs
🧰 Additional context used
🧬 Code graph analysis (22)
src/telegram/actions/admin_users/details.rs (1)
src/utils/general.rs (2)
pretty_format(164-164)pretty_format(168-189)
src/telegram/actions/language.rs (2)
src/telegram/keyboards.rs (2)
markup(25-36)markup(78-86)src/telegram/actions/login.rs (1)
send_login_invite(16-39)
src/cli/users.rs (1)
src/infrastructure/logger.rs (1)
init(37-61)
src/entity/track_status.rs (2)
src/services/track_status.rs (2)
TrackStatusService(45-45)TrackStatusService(47-165)src/entity/mod.rs (1)
track_status(6-6)
src/lyrics/musixmatch.rs (2)
src/lyrics/mod.rs (1)
musixmatch(18-18)src/main.rs (1)
lyrics(22-22)
src/workers/track_check.rs (1)
src/infrastructure/logger.rs (1)
init(37-61)
src/services/user.rs (1)
src/services/track_status.rs (1)
status(32-38)
src/infrastructure/error_handler.rs (1)
src/spotify/errors.rs (1)
SpotifyError(42-84)
src/tick/mod.rs (2)
src/infrastructure/error_handler.rs (2)
err(54-54)err(178-178)src/spotify/errors.rs (1)
err(44-44)
src/telegram/actions/recommendasion.rs (1)
src/spotify/mod.rs (2)
track_tg_link(191-197)name_with_artists(146-150)
src/lyrics/lrclib.rs (1)
src/lyrics/mod.rs (1)
SearchResult(30-41)
src/services/notification.rs (4)
src/user.rs (1)
user(31-33)src/telegram/inline_buttons.rs (1)
into(81-83)src/telegram/inline_buttons_admin.rs (1)
into(187-189)src/services/mod.rs (1)
notification(3-3)
src/metrics/mod.rs (1)
src/utils/general.rs (1)
ctrl_c(127-133)
src/telegram/actions/word_definition.rs (1)
src/telegram/handlers/mod.rs (1)
keyboards(4-4)
src/entity/user.rs (1)
src/user.rs (1)
language(43-45)
src/workers/queues.rs (2)
src/infrastructure/logger.rs (1)
init(37-61)src/utils/general.rs (1)
ctrl_c(127-133)
src/workers/server.rs (1)
src/infrastructure/logger.rs (1)
init(37-61)
src/telegram/actions/admin_users/list.rs (4)
src/services/track_status.rs (1)
status(32-38)src/telegram/inline_buttons.rs (1)
into(81-83)src/telegram/inline_buttons_admin.rs (1)
into(187-189)build.rs (2)
main(15-20)emit_git(3-13)
src/telegram/actions/global_stats.rs (1)
src/user.rs (1)
user_id(57-59)
src/telegram/actions/details.rs (1)
src/profanity.rs (1)
highlighted(161-178)
src/telegram/handlers/keyboards.rs (1)
src/telegram/handlers/mod.rs (1)
keyboards(4-4)
src/workers/bot.rs (1)
src/infrastructure/logger.rs (1)
init(37-61)
🔇 Additional comments (99)
src/tick/mod.rs (1)
161-163: LGTM! Formatting aligns with Clippy pedantic rules.The error-handling block formatting is now compliant with Clippy pedantic style expectations: proper semicolon placement and brace positioning. The error logging remains correct—using
tracing::error!with debug-formatted error output is idiomatic for structured logging in async contexts.src/telegram/handlers/url.rs (1)
15-17: LGTM!The removal of the trailing semicolon after the
if letblock is a correct style fix aligned with Clippy's pedantic linting rules. No behavioral change.src/utils/serde.rs (1)
15-15: LGTM! Idiomatic refactoring using standard library conversion.Replacing the explicit conditional with
u8::from(*b)is the idiomatic Rust approach for bool-to-u8 conversion. This produces the same output (1 for true, 0 for false) and aligns with Clippy's pedantic recommendations.src/entity/track_status.rs (1)
90-90: LGTM: AddingCopyto a simple enum improves ergonomics.The
Statusenum contains only simple discriminants with no associated data, making it an ideal candidate for theCopytrait. This change improves performance and ergonomics when passing status values around, as seen in theTrackStatusServicemethods whereStatusis frequently used by-value.src/telegram/actions/magic.rs (2)
98-98: LGTM! Clean removal of unnecessary semicolon.The semicolon after the closing brace was extraneous. This cleanup aligns with Clippy's pedantic linting rules and improves code consistency without any functional impact.
161-161: LGTM! Proper statement termination.The semicolon addition ensures explicit statement termination, which aligns with Clippy's pedantic linting preferences for code clarity and consistency.
src/telegram/actions/global_stats.rs (3)
13-16: LGTM! Parameter rename improves clarity.The change from
_statetostateand the corresponding tracing instrumentation update correctly address a clippy pedantic lint. Since the parameter is actually used in the tracing instrumentation, removing the underscore prefix eliminates potential confusion and makes the code more idiomatic.
61-61: LGTM! Semicolon addition improves consistency.Adding the explicit semicolon after the
push()statement aligns with Rust idioms for statement expressions, likely addressing a clippy pedantic lint.
66-93: LGTM! Raw string literal simplification.The change from
r#"..."#tor"..."correctly simplifies the raw string literal syntax. Since the string content doesn't contain sequences that require hash delimiters, using the simpler form improves readability without affecting functionality.src/telegram/actions/recommendasion.rs (6)
66-72: Good addition of#[must_use]attribute.The
#[must_use]attribute is appropriate for this pure formatting method that computes and returns data without side effects. This helps catch potential bugs where the return value might be accidentally ignored.
74-91: Good addition of#[must_use]attribute.Consistent with the other formatting method, this
#[must_use]attribute appropriately signals that the return value should not be ignored.
202-202: Good style fix removing unnecessary semicolon.The semicolon after the closing brace of an
if letstatement block is unnecessary in Rust. This Clippy pedantic fix improves code style consistency.
427-427: Good style fix removing unnecessary semicolon.Consistent with the other semicolon removals, this improves code style without changing behavior.
435-435: Good style fix removing unnecessary semicolon.Another appropriate semicolon removal that aligns with Rust idioms.
448-452: Excellent refactoring to method reference syntax.The change from
.map(|track| track.name_with_artists())to.map(ShortTrack::name_with_artists)is a more idiomatic Rust pattern that eliminates the redundant closure. This is functionally equivalent and more concise.src/spotify/mod.rs (6)
40-48: LGTM!Adding
#[must_use]to pure accessor methods is good practice and aligns with Clippy's pedantic recommendations.
158-165: LGTM!Using method references (
String::as_str,Id::id) instead of closures is more idiomatic and aligns with Clippy's pedantic recommendations.
310-316: LGTM!The
is_some_and(Token::is_expired)pattern is more concise and idiomatic than the previous explicit check, and correctly evaluates tofalsewhen the token isNone.
367-367: LGTM!Using
Arc::default()is explicit and clearer than relying on type inference withDefault::default().
445-451: LGTM!The
let ... elsepattern is more readable for early returns compared to explicitmatchblocks, and is the idiomatic Rust approach for this pattern.
460-465: LGTM!This change relies on Rust's deref coercion:
&self.spotify(whereself.spotify: TandT: Deref<Target = AuthCodeSpotify>) automatically coerces to&AuthCodeSpotify. This is equivalent to the explicit&*self.spotifybut more idiomatic.src/telegram/actions/like.rs (1)
45-45: LGTM: Formatting cleanupRemoved unnecessary semicolon after the closing brace. This aligns with Clippy's pedantic formatting rules without changing behavior.
src/telegram/actions/dislike.rs (1)
48-48: LGTM: Formatting cleanupRemoved unnecessary semicolon after the closing brace, consistent with Clippy pedantic linting rules.
src/telegram/actions/start.rs (1)
56-56: LGTM: Formatting cleanupRemoved unnecessary semicolon after the closing brace, consistent with the broader formatting standardization in this PR.
src/user.rs (3)
12-13: LGTM: Appropriate lint suppressionThe
#[allow(clippy::option_option)]attribute correctly acknowledges the intentional use of nestedOption. This pattern is appropriate here for tri-state caching:None(not yet checked),Some(None)(checked but no Spotify user),Some(Some(user))(Spotify user present).
21-29: LGTM: Good API hygiene improvementsThe
#[must_use]attribute on the constructor prevents accidental disposal of theUserStateinstance. The use ofMutex::default()is more idiomatic thanMutex::new(None)while maintaining equivalent behavior.
89-97: LGTM: More concise premium checkThe refactor to
is_some_andimproves readability by chaining the option checks. The logic correctly verifies both that the Spotify user exists and that their product tier is Premium.src/metrics/influx.rs (2)
43-44: LGTM: More explicit error handlingChanging the closure parameter from
_to()makes it explicit that the error type is the unit type, improving code clarity.
49-49: LGTM: Idiomatic default handlingRefactoring to
map_or_elseis the idiomatic Rust pattern for providing a default value whenOptionisNone. This maintains the same behavior while being more concise.src/metrics/mod.rs (1)
221-221: LGTM: Correct pattern matching for unit typeThe change from
Ok(_)to()correctly reflects thatctrl_c()returns the unit type()rather than aResult. This makes the pattern match more accurate and aligns with the function signature shown in the relevant code snippets.src/spotify/auth.rs (1)
55-57: LGTM: Modern Rust idiomThe let-else refactor improves readability by using Rust's modern pattern for early returns. This is semantically equivalent to the previous match expression but more concise.
src/services/user.rs (4)
49-50: LGTM: Appropriate lint suppressionThe
#[allow(clippy::needless_pass_by_value)]is reasonable here. While Clippy suggests passing&bool,boolis aCopytype with minimal cost, and passing by value is idiomatic for small Copy types in Rust.
59-59: LGTM: Cleaner boolean-to-integer conversionUsing
i32::from(profane)is more idiomatic than a conditional expression for convertingbooltoi32. This maintains the same semantics (false→0, true→1) with improved clarity.
107-120: LGTM: Query builder improvementsThe
#[must_use]attribute is appropriate for query builders, ensuring developers don't accidentally construct a query without executing it. The formatting cleanups (removing semicolons after closing braces) align with Clippy's pedantic rules.
362-365: LGTM: Builder pattern safetyAdding
#[must_use]to the stats query builder constructor prevents accidental creation of builders that are never executed, which is important for ensuring database updates actually occur.Cargo.toml (1)
82-96: LGTM! Well-balanced Clippy configuration.The pedantic lint configuration with targeted exceptions is appropriate. The allowed lints (cast operations, excessive bools, too many lines) are pragmatic choices that prevent overly restrictive linting while still gaining the benefits of pedantic-level checks.
src/cli/users.rs (4)
53-53: LGTM! Improved error message clarity.Using named interpolation
{user_id}makes the error message more explicit and maintainable.
59-59: LGTM! Improved output formatting.The named interpolation pattern
{user_id}and{role:?}is more explicit and easier to maintain.
82-82: LGTM! Simplified error formatting.Direct interpolation
{e}is cleaner than the previous formatting approach.
65-65: Logger initialization successfully converted to synchronous.The logger initialization has been converted from async to sync. All five call sites across the codebase (src/workers/server.rs, src/workers/track_check.rs, src/workers/bot.rs, src/workers/queues.rs, and src/cli/users.rs) have been updated to call
logger::init().expect(...)without.await. The function signature in src/infrastructure/logger.rs confirms the synchronous implementation with no remaining async patterns.src/app.rs (3)
38-46: LGTM! Appropriate use of#[must_use]for accessor methods.Adding
#[must_use]to these accessor methods ensures callers don't accidentally discard the returned references, which is a good practice for getters.
231-253: LGTM! Correctly removed unnecessary async.The function doesn't perform any async operations (no
.awaitcalls), so removingasyncis appropriate and improves performance by avoiding unnecessary async machinery.
268-268: LGTM! Consistent with synchronousinit_aisignature.The removal of
.awaitcorrectly matches the now-synchronousinit_aifunction signature.src/telegram/keyboards.rs (2)
13-49: LGTM! Appropriate#[must_use]attributes onStartKeyboardmethods.The
#[must_use]attributes oninto_button,markup, andfrom_strare appropriate since these methods construct values that should be used rather than discarded.
59-97: LGTM! Appropriate#[must_use]attributes onLanguageKeyboardmethods.The
#[must_use]attributes oninto_button,into_locale,markup, andparsecorrectly ensure the constructed values are not accidentally ignored.src/telegram/actions/language.rs (1)
25-39: LGTM! Logic inversion improves UX flow.The inverted conditional now correctly shows:
- Authenticated users: Get the
StartKeyboardmarkup to interact with bot features- Unauthenticated users: Get keyboard removed and receive a login invite
This is more intuitive than the previous logic.
src/utils/general.rs (2)
138-141: LGTM! Appropriate#[must_use]forClock::now().Adding
#[must_use]ensures callers don't accidentally discard the timestamp, which would be a logic error.
177-188: LGTM! Improved formatting with named parameters.Using named format parameters (
{centiseconds:02},{days:02}, etc.) improves code clarity and makes the formatting intent explicit.src/lyrics/musixmatch.rs (2)
48-48: LGTM! Eliminated redundant closure.Using
String::as_strdirectly instead of a closure|lyrics| lyrics.as_str()is more idiomatic and eliminates the Clippyredundant_closurewarning.
204-206: LGTM! Modern let-else pattern.The let-else pattern is more concise and idiomatic for early returns on pattern match failures, improving readability.
src/telegram/inline_buttons_admin.rs (3)
125-173: LGTM! Appropriate#[must_use]onlabel()method.Adding
#[must_use]ensures the constructed label isn't accidentally discarded, which would be a logic error since constructing labels has a purpose.
160-166: LGTM! Improved string formatting with named parameters.Using named interpolation (
{arrow},{status:?}) makes the format strings more explicit and maintainable.
177-182: LGTM! Appropriate#[must_use]on button constructor.Adding
#[must_use]tointo_inline_keyboard_button()correctly prevents accidentally discarding the constructed button.src/entity/user.rs (3)
47-50: LGTM! Good use of#[must_use]attribute.The
#[must_use]attribute onis_admin()ensures callers don't accidentally discard the boolean result, improving API safety.
204-216: LGTM! Appropriate#[must_use]attributes.Both
language()and the newlocale_codes()helper correctly use#[must_use]to prevent accidental discarding of their return values.
276-280: LGTM! Good use of#[must_use]attribute.The
#[must_use]attribute ensures the boolean result isn't ignored, consistent with the same attribute onModel::is_admin().src/telegram/actions/analyze.rs (1)
195-195: LGTM! More idiomatic empty string initialization.Using
String::new()instead of"".to_string()is the idiomatic way to create empty strings in Rust and is more efficient.src/telegram/inline_buttons.rs (3)
20-36: LGTM! Appropriate#[must_use]attribute.The
#[must_use]attribute ensures the computed label isn't discarded, which is correct for a pure function that returns a translated string.
40-67: LGTM! Good use of#[must_use]attribute.The
#[must_use]attribute ensures the constructed keyboard button vector isn't discarded. The locale parameter is correctly passed through to the button creation methods.
71-77: LGTM! Appropriate#[must_use]attribute.The
#[must_use]attribute ensures the created inline keyboard button isn't discarded, which is correct for this builder-style method.src/telegram/actions/word_definition.rs (2)
227-251: LGTM! More idiomatic empty string initialization.Using
String::new()instead of"".to_string()is the standard Rust idiom for creating empty strings and avoids unnecessary string conversion.
279-283: LGTM! Clearer conditional flow.The inverted conditional (checking
is_empty()first) makes the early-return pattern more explicit and improves readability.src/lyrics/utils.rs (2)
32-43: LGTM! Appropriate#[must_use]attribute.The
#[must_use]attribute ensures the computed track name variations aren't discarded, which is correct for this pure function.
52-66: LGTM! Good use of#[must_use]attributes.All three methods (
new(),confident(), andavg()) correctly use#[must_use]since they return computed values that should be consumed by the caller.src/lyrics/lrclib.rs (2)
49-49: LGTM! More concise method reference.Using
String::as_stras a method reference instead of a closure is more idiomatic and concise.
173-176: LGTM! More idiomatic option handling.Using
map_or_elsedirectly is more idiomatic than chainingmapwithunwrap_or_elseand avoids an intermediateOptionallocation.src/services/notification.rs (1)
39-58: LGTM! More idiomatic option handling.Using
map_orinstead ofmap+unwrap_oris more idiomatic and avoids unnecessary intermediate allocations. The direct variable interpolation in the format string is also cleaner.src/infrastructure/logger.rs (1)
9-38: All call sites have been correctly updated to the synchronous API.Verification confirms that no remaining
.awaitcalls exist onlogger::init()orlogger::loki(). All five call sites across the codebase (insrc/workers/bot.rs,src/workers/track_check.rs,src/workers/server.rs,src/workers/queues.rs, andsrc/cli/users.rs) correctly use the synchronous API.src/infrastructure/error_handler.rs (2)
23-23: LGTM: Excellent use of#[must_use]on result constructors.Adding
#[must_use]to these constructor methods ensures that callers don't accidentally ignore error handling results, improving code safety.Also applies to: 31-31, 39-39
182-203: LGTM: Clean refactoring from match to if-let.The refactoring simplifies the control flow while preserving the same error-handling logic. The specific
InvalidTokencase is handled first with user notification, then falls through to generic client error logging.src/lyrics/genius.rs (2)
220-221: LGTM: Explicit initialization improves clarity.Using
vec![]andLanguage::default()is more explicit and readable than the genericDefault::default(), making the intent clearer.
239-242: LGTM: Good API hygiene by making LyricsResponse private.Moving
LyricsResponseto a local struct withinget_lyricsappropriately reduces the public API surface since this type is only used internally for deserialization.src/telegram/handlers/keyboards.rs (1)
23-23: LGTM: Formatting cleanup.Removing the redundant semicolons after the if-let blocks improves code style consistency.
Also applies to: 42-42
src/queue/profanity_check.rs (1)
89-89: LGTM: Explicit unit type improves clarity.Changing from
Ok(_)toOk(())makes it explicit that a unit type is expected, improving code readability.src/workers/track_check.rs (1)
7-7: LGTM: Logger initialization updated to synchronous API.The change from
logger::init().awaittologger::init()aligns with the updated logger API that now returns a synchronousanyhow::Result<()>instead of a future.src/telegram/actions/broadcast.rs (1)
54-54: LGTM: Style consistency improvements.Making the unit type explicit with
Ok(())and adding the trailing semicolon improves code clarity and consistency.Also applies to: 57-57
src/telegram/utils.rs (1)
3-3: LGTM: Appropriate#[must_use]annotation.Adding
#[must_use]toextract_url_from_messageis good API design, ensuring callers don't accidentally ignore the extraction result.src/telegram/actions/admin_users/details.rs (1)
159-159: LGTM: Idiomatic Option handling withmap_or.Replacing
.map().unwrap_or()with.map_or()is more concise and efficient, avoiding intermediateOptionallocations. This is the idiomatic Rust pattern for transformingOptionvalues with a default.Also applies to: 169-169
src/telegram/actions/details.rs (3)
16-16: LGTM: Import supports method reference usage.The new import enables the idiomatic method reference on Line 280, where
LineResult::highlightedis used instead of a closure.
55-55: LGTM: Unnecessary semicolons removed.These semicolons after closing braces are unnecessary and their removal aligns with Clippy pedantic linting rules. No behavioral change.
Also applies to: 110-110
280-280: LGTM: Idiomatic method reference.Using
LineResult::highlightedas a method reference is more idiomatic than the closure form, making the code cleaner while maintaining identical behavior.src/workers/queues.rs (2)
10-10: LGTM: Logger initialization now synchronous.The removal of
.awaitaligns with the updatedinfrastructure::logger::init()function signature, which is now synchronous across the codebase.
27-27: LGTM: Explicit unit pattern.Changing from
_ =to() =makes the intent clearer that we're explicitly waiting for and discarding a unit value fromctrl_c().src/workers/bot.rs (2)
60-60: LGTM: Logger initialization now synchronous.Consistent with the synchronous logger API update applied across all worker files.
107-107: LGTM: Unnecessary semicolon removed.Removing the semicolon after the closing brace aligns with Clippy pedantic rules and has no behavioral impact.
src/telegram/actions/admin_users/list.rs (2)
101-106: LGTM: Simplified raw string delimiter.The
#delimiter is unnecessary for this raw string since it doesn't contain quotation marks. This simplification improves readability.
108-108: LGTM: Idiomaticmap_orusage.Refactoring from
.map(...).unwrap_or(...)to.map_or(...)is more idiomatic and efficient, avoiding an intermediateOptionallocation.src/telegram/commands.rs (2)
67-67: LGTM: Appropriate#[must_use]attributes.These attributes are well-placed on functions returning computed values (
Vec<BotCommand>andCommandDescriptions) that callers should consume. This helps prevent accidental misuse where the return value is ignored.Also applies to: 80-80
88-114: LGTM: Clearer control flow withif let.The refactoring from a
matchexpression toif let Some(...) elseis more idiomatic for this cache-hit pattern and improves readability without changing behavior.src/workers/server.rs (3)
34-34: LGTM: Explicit unit type in pattern match.Changing from
Ok(_)toOk(())makes it explicit that we're matching on the unit type, improving code clarity.
39-39: LGTM: Modern format syntax.Using
format!("{err}")instead offormat!("{}", err)is the modern Rust idiom, making the code more concise while maintaining identical behavior.
113-113: LGTM: Logger initialization now synchronous.Consistent with the synchronous logger API update applied across all entry points.
src/profanity.rs (7)
29-29: LGTM: Well-placed#[must_use]attributes.These attributes appropriately mark functions that perform computations and return meaningful values that shouldn't be ignored:
check()returns profanity check resultsshould_trigger()returns a boolean decisionget_profine_words()returns extracted profane wordshighlighted()returns formatted outputThis improves API safety across the profanity checking module.
Also applies to: 54-54, 139-139, 160-160, 180-180
40-47: LGTM: ErgonomicIntoIteratorimplementation.Implementing
IntoIteratorfor&CheckResultenables idiomatic for-loop iteration over check results while maintaining the existingiter()method. This is a standard pattern for collection-like types.
64-68: LGTM: Inverted condition logic.The condition has been inverted from
!=with swapped branches to==with flipped branches, maintaining identical behavior. This likely aligns with a Clippy pedantic lint preference for positive conditions.
111-111: LGTM: Explicit empty vector initialization.Using
vec![]is more explicit and idiomatic thanDefault::default()for creating an empty vector, improving code readability.
195-195: LGTM: Idiomaticcollect()usage.Using
iter.collect()instead ofHashSet::from_iter(iter)is more idiomatic, leveraging type inference from the function's return type signature.
316-316: LGTM: Trait method reference.Using
ToString::to_stringas a method reference is more idiomatic than the closure form, consistent with Rust best practices.
331-331: LGTM: Takes ownership forCopytype.Changing from
&selftoselfis appropriate forTypeWrappersince it implementsCopy(line 327). ForCopytypes, taking ownership is idiomatic and has no performance penalty since the value is duplicated rather than moved.
Enables Clippy's pedantic lint level with carefully selected exceptions for rules that don't align with project style. Applies all resulting lint fixes across the codebase to improve code quality and consistency.