Skip to content

Commit 1bd360a

Browse files
committed
rename unchecked_duration_subtraction -> unchecked_time_subtraction
1 parent f996037 commit 1bd360a

File tree

10 files changed

+23
-23
lines changed

10 files changed

+23
-23
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ Released 2023-04-20
952952

953953
* Moved [`uninlined_format_args`] to `pedantic` (Now allow-by-default)
954954
[#10265](https://github.com/rust-lang/rust-clippy/pull/10265)
955-
* Moved [`unchecked_duration_subtraction`] to `pedantic` (Now allow-by-default)
955+
* Moved [`unchecked_time_subtraction`] to `pedantic` (Now allow-by-default)
956956
[#10194](https://github.com/rust-lang/rust-clippy/pull/10194)
957957

958958
### Enhancements
@@ -1203,7 +1203,7 @@ Released 2023-01-26
12031203
[#9506](https://github.com/rust-lang/rust-clippy/pull/9506)
12041204
* [`unnecessary_safety_doc`]
12051205
[#9822](https://github.com/rust-lang/rust-clippy/pull/9822)
1206-
* [`unchecked_duration_subtraction`]
1206+
* [`unchecked_time_subtraction`]
12071207
[#9570](https://github.com/rust-lang/rust-clippy/pull/9570)
12081208
* [`manual_is_ascii_check`]
12091209
[#9765](https://github.com/rust-lang/rust-clippy/pull/9765)

book/src/lint_configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
779779
* [`transmute_ptr_to_ref`](https://rust-lang.github.io/rust-clippy/master/index.html#transmute_ptr_to_ref)
780780
* [`tuple_array_conversions`](https://rust-lang.github.io/rust-clippy/master/index.html#tuple_array_conversions)
781781
* [`type_repetition_in_bounds`](https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds)
782-
* [`unchecked_duration_subtraction`](https://rust-lang.github.io/rust-clippy/master/index.html#unchecked_duration_subtraction)
782+
* [`unchecked_time_subtraction`](https://rust-lang.github.io/rust-clippy/master/index.html#unchecked_time_subtraction)
783783
* [`uninlined_format_args`](https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args)
784784
* [`unnecessary_lazy_evaluations`](https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations)
785785
* [`unnested_or_patterns`](https://rust-lang.github.io/rust-clippy/master/index.html#unnested_or_patterns)

clippy_config/src/conf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ define_Conf! {
648648
transmute_ptr_to_ref,
649649
tuple_array_conversions,
650650
type_repetition_in_bounds,
651-
unchecked_duration_subtraction,
651+
unchecked_time_subtraction,
652652
uninlined_format_args,
653653
unnecessary_lazy_evaluations,
654654
unnested_or_patterns,

clippy_lints/src/declared_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ pub static LINTS: &[&crate::LintInfo] = &[
242242
crate::init_numbered_fields::INIT_NUMBERED_FIELDS_INFO,
243243
crate::inline_fn_without_body::INLINE_FN_WITHOUT_BODY_INFO,
244244
crate::instant_subtraction::MANUAL_INSTANT_ELAPSED_INFO,
245-
crate::instant_subtraction::UNCHECKED_DURATION_SUBTRACTION_INFO,
245+
crate::instant_subtraction::UNCHECKED_TIME_SUBTRACTION_INFO,
246246
crate::int_plus_one::INT_PLUS_ONE_INFO,
247247
crate::integer_division_remainder_used::INTEGER_DIVISION_REMAINDER_USED_INFO,
248248
crate::invalid_upcast_comparisons::INVALID_UPCAST_COMPARISONS_INFO,

clippy_lints/src/instant_subtraction.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ declare_clippy_lint! {
6161
/// let time_delta = Duration::from_secs(1).checked_sub(Duration::from_secs(5));
6262
/// ```
6363
#[clippy::version = "1.67.0"]
64-
pub UNCHECKED_DURATION_SUBTRACTION,
64+
pub UNCHECKED_TIME_SUBTRACTION,
6565
pedantic,
6666
"finds unchecked subtraction of a 'Duration' from an 'Instant' or 'Duration'"
6767
}
@@ -78,7 +78,7 @@ impl InstantSubtraction {
7878
}
7979
}
8080

81-
impl_lint_pass!(InstantSubtraction => [MANUAL_INSTANT_ELAPSED, UNCHECKED_DURATION_SUBTRACTION]);
81+
impl_lint_pass!(InstantSubtraction => [MANUAL_INSTANT_ELAPSED, UNCHECKED_TIME_SUBTRACTION]);
8282

8383
impl LateLintPass<'_> for InstantSubtraction {
8484
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &'_ Expr<'_>) {
@@ -104,7 +104,7 @@ impl LateLintPass<'_> for InstantSubtraction {
104104
&& !expr.span.from_expansion()
105105
&& self.msrv.meets(msrvs::TRY_FROM)
106106
{
107-
print_unchecked_duration_subtraction_sugg(cx, lhs, rhs, expr);
107+
print_unchecked_time_subtraction_sugg(cx, lhs, rhs, expr);
108108
}
109109
}
110110
}
@@ -135,7 +135,7 @@ fn print_manual_instant_elapsed_sugg(cx: &LateContext<'_>, expr: &Expr<'_>, sugg
135135
);
136136
}
137137

138-
fn print_unchecked_duration_subtraction_sugg(
138+
fn print_unchecked_time_subtraction_sugg(
139139
cx: &LateContext<'_>,
140140
left_expr: &Expr<'_>,
141141
right_expr: &Expr<'_>,
@@ -156,7 +156,7 @@ fn print_unchecked_duration_subtraction_sugg(
156156

157157
span_lint_and_sugg(
158158
cx,
159-
UNCHECKED_DURATION_SUBTRACTION,
159+
UNCHECKED_TIME_SUBTRACTION,
160160
expr.span,
161161
format!("unchecked subtraction of 'Duration' from '{left_ty}'"),
162162
"try",

tests/ui/manual_instant_elapsed.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![warn(clippy::manual_instant_elapsed)]
22
#![allow(clippy::unnecessary_operation)]
3-
#![allow(clippy::unchecked_duration_subtraction)]
3+
#![allow(clippy::unchecked_time_subtraction)]
44
#![allow(unused_variables)]
55
#![allow(unused_must_use)]
66

tests/ui/manual_instant_elapsed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![warn(clippy::manual_instant_elapsed)]
22
#![allow(clippy::unnecessary_operation)]
3-
#![allow(clippy::unchecked_duration_subtraction)]
3+
#![allow(clippy::unchecked_time_subtraction)]
44
#![allow(unused_variables)]
55
#![allow(unused_must_use)]
66

tests/ui/unchecked_time_subtraction.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![warn(clippy::unchecked_duration_subtraction)]
1+
#![warn(clippy::unchecked_time_subtraction)]
22

33
use std::time::{Duration, Instant};
44

tests/ui/unchecked_time_subtraction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![warn(clippy::unchecked_duration_subtraction)]
1+
#![warn(clippy::unchecked_time_subtraction)]
22

33
use std::time::{Duration, Instant};
44

tests/ui/unchecked_time_subtraction.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
error: unchecked subtraction of 'Duration' from 'Instant'
2-
--> tests/ui/unchecked_duration_subtraction.rs:10:13
2+
--> tests/ui/unchecked_time_subtraction.rs:10:13
33
|
44
LL | let _ = instant - duration;
55
| ^^^^^^^^^^^^^^^^^^ help: try: `instant.checked_sub(duration).unwrap()`
66
|
7-
= note: `-D clippy::unchecked-duration-subtraction` implied by `-D warnings`
8-
= help: to override `-D warnings` add `#[allow(clippy::unchecked_duration_subtraction)]`
7+
= note: `-D clippy::unchecked-time-subtraction` implied by `-D warnings`
8+
= help: to override `-D warnings` add `#[allow(clippy::unchecked_time_subtraction)]`
99

1010
error: unchecked subtraction of 'Duration' from 'Instant'
11-
--> tests/ui/unchecked_duration_subtraction.rs:12:13
11+
--> tests/ui/unchecked_time_subtraction.rs:12:13
1212
|
1313
LL | let _ = Instant::now() - Duration::from_secs(5);
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Instant::now().checked_sub(Duration::from_secs(5)).unwrap()`
1515

1616
error: unchecked subtraction of 'Duration' from 'Instant'
17-
--> tests/ui/unchecked_duration_subtraction.rs:14:13
17+
--> tests/ui/unchecked_time_subtraction.rs:14:13
1818
|
1919
LL | let _ = instant - Duration::from_secs(5);
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `instant.checked_sub(Duration::from_secs(5)).unwrap()`
2121

2222
error: unchecked subtraction of 'Duration' from 'Instant'
23-
--> tests/ui/unchecked_duration_subtraction.rs:16:13
23+
--> tests/ui/unchecked_time_subtraction.rs:16:13
2424
|
2525
LL | let _ = Instant::now() - duration;
2626
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Instant::now().checked_sub(duration).unwrap()`
2727

2828
error: unchecked subtraction of 'Duration' from 'Duration'
29-
--> tests/ui/unchecked_duration_subtraction.rs:18:13
29+
--> tests/ui/unchecked_time_subtraction.rs:18:13
3030
|
3131
LL | let _ = Duration::from_secs(1) - duration;
3232
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Duration::from_secs(1).checked_sub(duration).unwrap()`
3333

3434
error: unchecked subtraction of 'Duration' from 'Duration'
35-
--> tests/ui/unchecked_duration_subtraction.rs:20:13
35+
--> tests/ui/unchecked_time_subtraction.rs:20:13
3636
|
3737
LL | let _ = duration2 - duration;
3838
| ^^^^^^^^^^^^^^^^^^^^ help: try: `duration2.checked_sub(duration).unwrap()`
3939

4040
error: unchecked subtraction of 'Duration' from 'Duration'
41-
--> tests/ui/unchecked_duration_subtraction.rs:22:13
41+
--> tests/ui/unchecked_time_subtraction.rs:22:13
4242
|
4343
LL | let _ = Instant::now().elapsed() - duration;
4444
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Instant::now().elapsed().checked_sub(duration).unwrap()`

0 commit comments

Comments
 (0)