icu4x
icu4x copied to clipboard
Resolve inline Clippy lints (comment explaining why it is OK or code changes)
As part of resolving issue #1363 , codebase needs a lot of inline allow clippy code. This is expected to touch all production code folders.
Solution : The resolution strategy is either a well written comment explaining why it's ok or necessary code change to remove inline allow.
@robertbastian will clean up low-hanging fruit, and create child issues for each component
These are all the remaining undocumented lints that I couldn't fix. Please fix them or tell me how to.
- [x]
icu_calendar, @Manishearth- [x]
Ethiopian::ethiopian_from_fixed
- [x]
- [ ]
icu_datetime, @zbraniecki ?- [ ]
Parser::handle_generic_quoted_literal - [ ]
Parser::collect_generic_segment - [ ]
PatternPlurals::expect_pattern(looks like an intended panic) - [ ]
skeleton::helpers::create_best_pattern_for_fields - [ ]
skeleton::helpers::get_best_available_format_pattern(x2)
- [ ]
- [ ]
icu_plurals, @zbraniecki ?- [ ]
Lexer::advance_token - [ ]
Rule - [ ]
From<&Value> for u32 - [ ]
internal::to_icu4x_operands
- [ ]
- [x]
fixed_decimal, @younies- [x]
Sign - [x]
FromStr for FixedDecimal(x3) - [x]
DoublePrecision
- [x]
- [x]
zerovec, @Manishearth, @sffc- [ ] #1410
zerovec and calendars in #2435
@zbraniecki Assigning this to you since the remaining work is all in components you own.
Why do we require comment to be added to panic!() which has content string?
It feels weird to have:
panic!("We panic because X");
have to be turned to:
panic!("We panic because of X"); // We panic because of X
@zbraniecki to me, the panic message is for the user, and the comment is for us. If they're redundant it feels fine to not comment it IMO.
@zbraniecki I've raised that concern before (also for expect) but the consensus of the group has been to require suppressions for all four (unwrap, expect, panic, and indexing_slicing).
For example, the following is the style we're going for: the comment and the panic message are disjoint
/// # Panics
/// Panics if idx is not in bounds
fn get(idx: usize) {
if idx >= self.len() {
#[allow(clippy::panic)] // documented
panic!("index must be in bounds");
}
// ...
}