feat: implement pr_missing_newline lint and fix build #10
+127
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #9
Description
This PR introduces a new lint
pr_missing_newlinethat detectspr_*logging macro calls without a trailing"\n". Proper newline termination in kernel-style logging is essential to prevent concatenated or malformed log output.Key goals achieved:
pr_*macros (excludingpr_cont) for missing trailing newlines.klintso it runs alongside existing lints.pr_*calls.Acceptance Criteria Fulfillment
PrMissingNewlinelint and registered it as an early lint inklint.pr_*calls without trailing"\n", exceptpr_cont.tests/ui/pr_missing_newline.rsvalidating proper detection.Changes Summary
New Lint:
pr_missing_newlineimplemented insrc/hir_lints/pr_missing_newline.rs.Lint Registration: Registered in
src/main.rsunder early lints.Tests: Added
tests/ui/pr_missing_newline.rscovering:pr_contcalls → exemptBuild/Test Fixes:
src/main.rsand other modulesMinor Dependency Updates: Updated
Cargo.toml/Cargo.lockas needed for build/test stability.Limitations (Experimental Phase)
pr_*usage patterns; unusual token streams could bypass detection.pr_contas per kernel logging conventions.How to Test
Run all tests to ensure nothing breaks:
cargo testCheck the UI test specifically:
cargo test --test compile-testAdd a
pr_*macro without a trailing newline in any Rust file, and confirm thatklintwarns appropriately.