Skip to content

Fix post-#263 clippy warnings in sudachi crate#330

Closed
gulldan wants to merge 1 commit into
WorksApplications:developfrom
gulldan:fix/clippy-warnings-post-263
Closed

Fix post-#263 clippy warnings in sudachi crate#330
gulldan wants to merge 1 commit into
WorksApplications:developfrom
gulldan:fix/clippy-warnings-post-263

Conversation

@gulldan
Copy link
Copy Markdown
Contributor

@gulldan gulldan commented May 11, 2026

Partial fix for #40.

This fixes default-level clippy/rustc warnings introduced after #263 in the sudachi crate only.
No API or behavior changes are intended.

Fixed:

  • mismatched_lifetime_syntaxes: make elided lifetimes explicit on return types
  • needless_as_bytes
  • needless_return
  • unnecessary_lazy_evaluations
  • unnecessary_sort_by
  • missing_transmute_annotations
  • needless_lifetimes
  • empty_line_after_doc_comments

Intentionally left out:

  • result_large_err
  • dead-code warnings
  • &Vec / &String signature changes
  • StringNumber::to_string rename
  • sudachi-fuzz unexpected_cfgs(fuzzing)
  • python/ transmute annotations

Tested:

  • cargo fmt -- --check --files-with-diff
  • cargo test --verbose

@gulldan gulldan changed the title fix clippy warnings Fix post-#263 clippy warnings in sudachi crate May 11, 2026
Address default-level clippy warnings introduced after WorksApplications#263, all in
the `sudachi` crate. No API or behavior changes.

- add explicit `<'_>` to return types where a lifetime is elided
  elsewhere in the signature (`mismatched_lifetime_syntaxes`)
- drop redundant `as_bytes()` before `.len()` on `&str`
- drop unneeded trailing `return` statements
- prefer `sort_by_key` over `sort_by` for simple key extraction
- replace `ok_or_else(|| ...)` with `ok_or(...)` when the value is
  trivially constructible
- annotate `transmute` source/target types in `CowArray::set`,
  making the lifetime extension to `'a` explicit at the call site
- elide unused explicit lifetime in `UserPosSupport for &mut Grammar`
- remove blank line between doc comment and item in `sentence_detector`

Refs WorksApplications#40
@gulldan gulldan force-pushed the fix/clippy-warnings-post-263 branch from 47039c8 to c89f297 Compare May 11, 2026 13:49
@hayashi-mas-wap
Copy link
Copy Markdown
Contributor

Thank you for your contribution, however, as we have large diffs in develop-v0.7, I rather want to skip this fix in develop.

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