Skip to content

Add new lint manual_duration_calcs #6490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8a66872
Rename from duration_subsec to manual_duration_calcs
himanoa Oct 26, 2020
b192c6e
Rename duration_subsec to manual_duration_cals in code
himanoa Oct 26, 2020
7c03f88
Add ui test cases
himanoa Oct 26, 2020
7fa4680
Fix a broken test case
himanoa Oct 30, 2020
9374559
Implemented manual_re_implementation_as_secs_f64
himanoa Oct 30, 2020
ab77045
Add test case
himanoa Oct 30, 2020
87c88ae
Rename from manual_re_implementation_as_secs_f64 to manual_re_impleme…
himanoa Oct 30, 2020
2ccbe24
Implement manual_re_implementation_as_secs_f64_for_mul
himanoa Oct 31, 2020
48cf680
Fix a comment
himanoa Oct 31, 2020
31a119d
Add a same receiver guard
himanoa Nov 2, 2020
c9edeaa
Implemented manual_re_implementation_as_secs_f64_for_div_and_mul
himanoa Dec 16, 2020
1d5dd50
Exec cargo dev bless
himanoa Dec 16, 2020
df6cab3
Fix code format errors
himanoa Dec 21, 2020
a00c908
Execute cargo dev update_lints
himanoa Dec 21, 2020
b863fed
Add examples for manual_duration_calcs
himanoa Dec 21, 2020
4259cd9
Fix a dogfood lint errors
himanoa Dec 21, 2020
6472a9d
Refactor manual_re_implementation_lower_the_unit implementation
himanoa Dec 22, 2020
ef0b59c
Change the order of LateContext argumens
himanoa Dec 23, 2020
dfc0309
Rename from manual_re_implementation_as_secs_f64_for_div to manual_re…
himanoa Dec 23, 2020
ca30016
Implemented utility functions
himanoa Dec 25, 2020
e8b439f
Use parse_method_call_expr and get_divisor function with parse_divisi…
himanoa Dec 25, 2020
ed25378
Refactor manual_re_implementation_upper_the_unit implementation
himanoa Dec 25, 2020
ba820ac
Fix dogfood test errors
himanoa Dec 25, 2020
d0a2887
Change the Divisor enum entry names.
himanoa Dec 25, 2020
8a4fac9
Change the type name from Divisor to Number
himanoa Dec 25, 2020
a6dca1f
Use consts::Constant instead of Numeral.
himanoa Dec 25, 2020
f070a9d
Supported F32 and F64 types with manual_re_implementation_lower_the_unit
himanoa Dec 25, 2020
91a5fb7
Refactor extract_multiple_expr interface
himanoa Dec 25, 2020
78390c4
Implemented manual re implementation duration_as_secs rule
himanoa Dec 25, 2020
113dc8b
Support composite division and multiply pattern
himanoa Jan 4, 2021
df6ee42
Add test cases
himanoa Jan 4, 2021
8f96dc4
cargo dev bless
himanoa Jan 4, 2021
d2f1700
Use register_renamed instead of register_late_pass
himanoa Jan 5, 2021
7ff7eb3
Revert "Execute cargo dev update_lints"
himanoa Jan 5, 2021
2a5a51c
Execute cargo dev update_lints
himanoa Jan 5, 2021
a13726a
Fix a cargo dev fmt error
himanoa Jan 5, 2021
d16e9f6
Add store.register_late_pass
himanoa Jan 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,6 @@ Released 2018-09-13
[`drop_copy`]: https://rust-lang.github.io/rust-clippy/master/index.html#drop_copy
[`drop_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#drop_ref
[`duplicate_underscore_argument`]: https://rust-lang.github.io/rust-clippy/master/index.html#duplicate_underscore_argument
[`duration_subsec`]: https://rust-lang.github.io/rust-clippy/master/index.html#duration_subsec
[`else_if_without_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#else_if_without_else
[`empty_enum`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_enum
[`empty_line_after_outer_attr`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_outer_attr
Expand Down Expand Up @@ -1904,6 +1903,7 @@ Released 2018-09-13
[`macro_use_imports`]: https://rust-lang.github.io/rust-clippy/master/index.html#macro_use_imports
[`main_recursion`]: https://rust-lang.github.io/rust-clippy/master/index.html#main_recursion
[`manual_async_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_async_fn
[`manual_duration_calcs`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_duration_calcs
[`manual_memcpy`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_memcpy
[`manual_non_exhaustive`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive
[`manual_ok_or`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_or
Expand Down
71 changes: 0 additions & 71 deletions clippy_lints/src/duration_subsec.rs

This file was deleted.

11 changes: 6 additions & 5 deletions clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ mod doc;
mod double_comparison;
mod double_parens;
mod drop_forget_ref;
mod duration_subsec;
mod else_if_without_else;
mod empty_enum;
mod entry;
Expand Down Expand Up @@ -236,6 +235,7 @@ mod loops;
mod macro_use;
mod main_recursion;
mod manual_async_fn;
mod manual_duration_calcs;
mod manual_non_exhaustive;
mod manual_ok_or;
mod manual_strip;
Expand Down Expand Up @@ -582,7 +582,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
&drop_forget_ref::DROP_REF,
&drop_forget_ref::FORGET_COPY,
&drop_forget_ref::FORGET_REF,
&duration_subsec::DURATION_SUBSEC,
&else_if_without_else::ELSE_IF_WITHOUT_ELSE,
&empty_enum::EMPTY_ENUM,
&entry::MAP_ENTRY,
Expand Down Expand Up @@ -678,6 +677,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
&macro_use::MACRO_USE_IMPORTS,
&main_recursion::MAIN_RECURSION,
&manual_async_fn::MANUAL_ASYNC_FN,
&manual_duration_calcs::MANUAL_DURATION_CALCS,
&manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE,
&manual_ok_or::MANUAL_OK_OR,
&manual_strip::MANUAL_STRIP,
Expand Down Expand Up @@ -1107,7 +1107,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
store.register_late_pass(|| box inherent_impl::MultipleInherentImpl::default());
store.register_late_pass(|| box neg_cmp_op_on_partial_ord::NoNegCompOpForPartialOrd);
store.register_late_pass(|| box unwrap::Unwrap);
store.register_late_pass(|| box duration_subsec::DurationSubsec);
store.register_late_pass(|| box manual_duration_calcs::ManualDurationCalcs);
store.register_late_pass(|| box indexing_slicing::IndexingSlicing);
store.register_late_pass(|| box non_copy_const::NonCopyConst);
store.register_late_pass(|| box ptr_offset_with_cast::PtrOffsetWithCast);
Expand Down Expand Up @@ -1397,7 +1397,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&drop_forget_ref::DROP_REF),
LintId::of(&drop_forget_ref::FORGET_COPY),
LintId::of(&drop_forget_ref::FORGET_REF),
LintId::of(&duration_subsec::DURATION_SUBSEC),
LintId::of(&entry::MAP_ENTRY),
LintId::of(&enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT),
LintId::of(&enum_variants::ENUM_VARIANT_NAMES),
Expand Down Expand Up @@ -1460,6 +1459,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&loops::WHILE_LET_ON_ITERATOR),
LintId::of(&main_recursion::MAIN_RECURSION),
LintId::of(&manual_async_fn::MANUAL_ASYNC_FN),
LintId::of(&manual_duration_calcs::MANUAL_DURATION_CALCS),
LintId::of(&manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE),
LintId::of(&manual_strip::MANUAL_STRIP),
LintId::of(&manual_unwrap_or::MANUAL_UNWRAP_OR),
Expand Down Expand Up @@ -1758,7 +1758,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&booleans::NONMINIMAL_BOOL),
LintId::of(&double_comparison::DOUBLE_COMPARISONS),
LintId::of(&double_parens::DOUBLE_PARENS),
LintId::of(&duration_subsec::DURATION_SUBSEC),
LintId::of(&eval_order_dependence::DIVERGING_SUB_EXPRESSION),
LintId::of(&eval_order_dependence::EVAL_ORDER_DEPENDENCE),
LintId::of(&explicit_write::EXPLICIT_WRITE),
Expand All @@ -1773,6 +1772,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&loops::MUT_RANGE_BOUND),
LintId::of(&loops::SINGLE_ELEMENT_LOOP),
LintId::of(&loops::WHILE_LET_LOOP),
LintId::of(&manual_duration_calcs::MANUAL_DURATION_CALCS),
LintId::of(&manual_strip::MANUAL_STRIP),
LintId::of(&manual_unwrap_or::MANUAL_UNWRAP_OR),
LintId::of(&map_identity::MAP_IDENTITY),
Expand Down Expand Up @@ -2026,6 +2026,7 @@ pub fn register_renamed(ls: &mut rustc_lint::LintStore) {
ls.register_renamed("clippy::identity_conversion", "clippy::useless_conversion");
ls.register_renamed("clippy::zero_width_space", "clippy::invisible_characters");
ls.register_renamed("clippy::single_char_push_str", "clippy::single_char_add_str");
ls.register_renamed("clippy::duration_subsec", "clippy::manual_duration_calcs")
}

// only exists to let the dogfood integration test works.
Expand Down
Loading