Skip to content

Commit d01f878

Browse files
committed
Fix CVE-2022-24713, fix clippy lints
1 parent 34ee384 commit d01f878

File tree

5 files changed

+62
-68
lines changed

5 files changed

+62
-68
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [2.3.1](https://crates.io/crates/rtw/2.3.1) Jun 6, 2021
99

10+
* Fix CVE-2022-24713
1011
* Remove superfluous config crate features, fixes CVE-2020-25573.
1112
* Bump `htp` to `0.4.0` cf [htp changelog](https://github.com/PicoJr/htp/blob/master/CHANGELOG.md)
1213

Cargo.lock

Lines changed: 49 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,8 @@ chrono-humanize = "0.1.2"
3232

3333
[dev-dependencies]
3434
tempfile = "3"
35-
assert_cmd = "0.12"
36-
predicates = "1.0.4"
35+
assert_cmd = "2.0.4"
36+
predicates = "2.1.1"
37+
38+
# Fix CVE-2022-24713
39+
regex = "1.5.5"

src/cli_helper.rs

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,7 @@ pub fn parse_stop_args(
363363
stop_m: &ArgMatches,
364364
clock: &dyn Clock,
365365
) -> anyhow::Result<(Time, Option<ActivityId>)> {
366-
let stopped_id_maybe = stop_m
367-
.value_of("id")
368-
.map(|id_str| usize::from_str(id_str))
369-
.transpose()?;
366+
let stopped_id_maybe = stop_m.value_of("id").map(usize::from_str).transpose()?;
370367
let time_arg = stop_m.values_of("time");
371368
if let Some(values) = time_arg {
372369
let values: Vec<String> = values.map(String::from).collect();
@@ -379,18 +376,12 @@ pub fn parse_stop_args(
379376
}
380377

381378
pub fn parse_continue_args(continue_m: &ArgMatches) -> anyhow::Result<Option<ActivityId>> {
382-
let continue_id_maybe = continue_m
383-
.value_of("id")
384-
.map(|id_str| usize::from_str(id_str))
385-
.transpose()?;
379+
let continue_id_maybe = continue_m.value_of("id").map(usize::from_str).transpose()?;
386380
Ok(continue_id_maybe)
387381
}
388382

389383
pub fn parse_cancel_args(cancel_m: &ArgMatches) -> anyhow::Result<Option<ActivityId>> {
390-
let cancelled_id_maybe = cancel_m
391-
.value_of("id")
392-
.map(|id_str| usize::from_str(id_str))
393-
.transpose()?;
384+
let cancelled_id_maybe = cancel_m.value_of("id").map(usize::from_str).transpose()?;
394385
Ok(cancelled_id_maybe)
395386
}
396387

@@ -456,9 +447,7 @@ pub fn parse_timeline_args(
456447
}
457448

458449
pub fn parse_delete_args(delete_m: &ArgMatches) -> anyhow::Result<ActivityId> {
459-
let id_opt = delete_m
460-
.value_of("id")
461-
.map(|id_str| usize::from_str(id_str));
450+
let id_opt = delete_m.value_of("id").map(usize::from_str);
462451
if let Some(Ok(id)) = id_opt {
463452
Ok(id)
464453
} else {

src/timeline.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub(crate) fn render_days(activities: &[Interval], colors: &[Rgb]) -> anyhow::Re
192192
for day in min_day..=max_day {
193193
let day_activities: Vec<Interval> = activities
194194
.iter()
195-
.flat_map(|interval| split_interval(interval))
195+
.flat_map(split_interval)
196196
.filter(|(_, a)| {
197197
let start_time: DateTime<Local> = a.get_start_time().into();
198198
start_time.num_days_from_ce() == day
@@ -241,14 +241,14 @@ pub(crate) fn render_days(activities: &[Interval], colors: &[Rgb]) -> anyhow::Re
241241
if j == 0 {
242242
rendered.push(format!("{}{:>8}", line, day_month));
243243
} else {
244-
rendered.push(format!("{}{:>8}", line, " ".to_string()));
244+
rendered.push(format!("{}{:>8}", line, " "));
245245
}
246246
}
247247
for (j, line) in data_timelines.iter().enumerate() {
248248
if j == 0 {
249249
rendered.push(format!("{}{}", line, total_string));
250250
} else {
251-
rendered.push(format!("{}{:>8}", line, " ".to_string()));
251+
rendered.push(format!("{}{:>8}", line, " "));
252252
}
253253
}
254254
}

0 commit comments

Comments
 (0)