You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
2.0 KiB
Markdown
62 lines
2.0 KiB
Markdown
+++
|
|
title = "Fix compiler warnings in api and ui binaries"
|
|
priority = 7
|
|
status = "done"
|
|
ticket_type = "bug"
|
|
dependencies = []
|
|
+++
|
|
## Bug
|
|
|
|
Running `cargo build --target wasm32-unknown-unknown` (and `trunk build`) produces compiler warnings in both the `api` and `ui` binaries. All warnings should be resolved so the build is clean.
|
|
|
|
## Warnings
|
|
|
|
Reproduce with:
|
|
```sh
|
|
# From quotesdb/ root
|
|
cargo build --target wasm32-unknown-unknown 2>&1 | grep -E 'warning\[|warning: (fields|unused|duplicated)'
|
|
```
|
|
|
|
### UI binary (1 warning)
|
|
|
|
**`src/bin/ui/api.rs:21:9`** — `fields page and total_count are never read`
|
|
|
|
The `QuotesResponse` struct (or equivalent) has `page` and `total_count` fields that are deserialized from the API but never read by any UI code. Either:
|
|
- Remove the fields if they are genuinely unused, or
|
|
- Add `#[allow(dead_code)]` with a comment explaining they are reserved for future pagination UI, or
|
|
- Actually use them (e.g. pass `total_count` to the browse page for "X quotes total" display)
|
|
|
|
Preferred fix: use them or remove them. Avoid bare `#[allow(dead_code)]` without justification.
|
|
|
|
### API binary (2 warnings)
|
|
|
|
**`src/bin/api/db/d1.rs:9:8`** — `duplicated attribute`
|
|
|
|
A `#[cfg(...)]` or other attribute is duplicated on the same item. Remove the duplicate.
|
|
|
|
**`src/bin/api/db/mod.rs:27:9`** — `unused import: d1::D1Repository`
|
|
|
|
`D1Repository` is imported but never used in this module. Remove the import.
|
|
|
|
## Files
|
|
|
|
- `src/bin/ui/api.rs` (line 21)
|
|
- `src/bin/api/db/d1.rs` (line 9)
|
|
- `src/bin/api/db/mod.rs` (line 27)
|
|
|
|
## Validation
|
|
|
|
```sh
|
|
# From quotesdb/ root
|
|
cargo fmt && cargo check && cargo clippy && cargo test
|
|
|
|
# Confirm zero warnings for ui binary
|
|
cargo build --target wasm32-unknown-unknown 2>&1 | grep 'warning:.*generated'
|
|
# Expected: no output (or "0 warnings")
|
|
```
|
|
|
|
Also run `trunk build` and confirm no warnings are emitted for the `quotesdb` crate (dependency warnings from third-party crates are acceptable).
|
|
|
|
## Commit scope
|
|
|
|
`fix(quotesdb): resolve compiler warnings in api and ui` |