Adopt universal clippy/lint baseline; warnings to zero
Add the shared pedantic + unreachable_pub lint baseline. All resulting
warnings were machine-applicable (clippy --fix: redundant-closure and
bool-to-int rewrites in lib.rs); no residue to hand-fix.
clippy --all-targets clean, cargo fmt clean, 148 tests green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2 files changed,
+32 insertions,
-4 deletions
| 16 |
16 |
|
[[bench]]
|
| 17 |
17 |
|
name = "tagtree_bench"
|
| 18 |
18 |
|
harness = false
|
|
19 |
+ |
|
|
20 |
+ |
[lints.rust]
|
|
21 |
+ |
unused = "warn"
|
|
22 |
+ |
unreachable_pub = "warn"
|
|
23 |
+ |
|
|
24 |
+ |
[lints.clippy]
|
|
25 |
+ |
pedantic = { level = "warn", priority = -1 }
|
|
26 |
+ |
# Allow-list tuned from a measured breakdown across server/multithreaded/pter
|
|
27 |
+ |
# (2026-07-22). These are the high-churn / low-signal pedantic lints; everything
|
|
28 |
+ |
# else in `pedantic` stays a warning. Keep this block identical across repos.
|
|
29 |
+ |
module_name_repetitions = "allow"
|
|
30 |
+ |
# Doc lints — no docs-completeness push underway.
|
|
31 |
+ |
missing_errors_doc = "allow"
|
|
32 |
+ |
missing_panics_doc = "allow"
|
|
33 |
+ |
doc_markdown = "allow"
|
|
34 |
+ |
# Numeric casts — endemic and mostly intentional in size/byte math.
|
|
35 |
+ |
cast_possible_truncation = "allow"
|
|
36 |
+ |
cast_sign_loss = "allow"
|
|
37 |
+ |
cast_precision_loss = "allow"
|
|
38 |
+ |
cast_possible_wrap = "allow"
|
|
39 |
+ |
cast_lossless = "allow"
|
|
40 |
+ |
# Subjective structure/style nags — high churn, low signal.
|
|
41 |
+ |
must_use_candidate = "allow"
|
|
42 |
+ |
too_many_lines = "allow"
|
|
43 |
+ |
struct_excessive_bools = "allow"
|
|
44 |
+ |
similar_names = "allow"
|
|
45 |
+ |
items_after_statements = "allow"
|
|
46 |
+ |
single_match_else = "allow"
|
| 478 |
478 |
|
/// ```
|
| 479 |
479 |
|
pub fn subtree<'a>(prefix: &str, tags: &'a [impl AsRef<str>]) -> Vec<&'a str> {
|
| 480 |
480 |
|
tags.iter()
|
| 481 |
|
- |
.map(|t| t.as_ref())
|
|
481 |
+ |
.map(std::convert::AsRef::as_ref)
|
| 482 |
482 |
|
.filter(|tag| {
|
| 483 |
483 |
|
prefix.is_empty()
|
| 484 |
484 |
|
|| *tag == prefix
|
| 571 |
571 |
|
row[0] = j;
|
| 572 |
572 |
|
let mut row_min = row[0];
|
| 573 |
573 |
|
for i in 1..=a.len() {
|
| 574 |
|
- |
let cost = if a[i - 1] == b[j - 1] { 0 } else { 1 };
|
|
574 |
+ |
let cost = usize::from(a[i - 1] != b[j - 1]);
|
| 575 |
575 |
|
let val = (row[i] + 1).min(row[i - 1] + 1).min(prev + cost);
|
| 576 |
576 |
|
prev = row[i];
|
| 577 |
577 |
|
row[i] = val;
|
| 786 |
786 |
|
fn build_segments(tags: &[String]) -> Vec<String> {
|
| 787 |
787 |
|
let mut segs: Vec<String> = tags
|
| 788 |
788 |
|
.iter()
|
| 789 |
|
- |
.flat_map(|t| t.split(SEPARATOR).map(|s| s.to_string()))
|
|
789 |
+ |
.flat_map(|t| t.split(SEPARATOR).map(std::string::ToString::to_string))
|
| 790 |
790 |
|
.collect();
|
| 791 |
791 |
|
segs.sort_unstable();
|
| 792 |
792 |
|
segs.dedup();
|
| 845 |
845 |
|
|
| 846 |
846 |
|
/// Iterate all tags in sorted order.
|
| 847 |
847 |
|
pub fn iter(&self) -> impl Iterator<Item = &str> {
|
| 848 |
|
- |
self.tags.iter().map(|s| s.as_str())
|
|
848 |
+ |
self.tags.iter().map(std::string::String::as_str)
|
| 849 |
849 |
|
}
|
| 850 |
850 |
|
|
| 851 |
851 |
|
/// Check if any segment in the index starts with `prefix` (binary search, O(log m)).
|