Skip to content

Commit 8d7a138

Browse files
committed
Update MSRV to 1.88
1 parent 9eb423b commit 8d7a138

File tree

16 files changed

+59
-59
lines changed

16 files changed

+59
-59
lines changed

.github/workflows/regression.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- uses: actions/checkout@v3
5656
- uses: dtolnay/rust-toolchain@v1
5757
with:
58-
toolchain: 1.76.0
58+
toolchain: 1.88.0
5959
targets: x86_64-unknown-linux-gnu
6060
- name: Run build
6161
run: cargo build

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ categories = ["command-line-utilities"]
88
license = "MIT"
99
readme = "README.md"
1010
description = "A modern replacement for ps"
11-
edition = "2021"
11+
edition = "2024"
1212
exclude = ["img/*", "config/*"]
13-
rust-version = "1.76"
13+
rust-version = "1.88"
1414

1515
[package.metadata.release]
1616
pre-release-commit-message = "Prepare to v{{version}}"

src/columns/context_sw.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ impl ContextSw {
3030
impl Column for ContextSw {
3131
fn add(&mut self, proc: &ProcessInfo) {
3232
let (fmt_content, raw_content) = if let Some(ref status) = proc.curr_status {
33-
if status.voluntary_ctxt_switches.is_some()
34-
&& status.nonvoluntary_ctxt_switches.is_some()
33+
if let Some(voluntary_ctxt_switches) = status.voluntary_ctxt_switches
34+
&& let Some(nonvoluntary_ctxt_switches) = status.nonvoluntary_ctxt_switches
3535
{
36-
let sw = status.voluntary_ctxt_switches.unwrap()
37-
+ status.nonvoluntary_ctxt_switches.unwrap();
36+
let sw = voluntary_ctxt_switches
37+
+ nonvoluntary_ctxt_switches;
3838
(bytify(sw), sw)
3939
} else {
4040
(String::new(), 0)

src/columns/involuntary_context_sw.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::process::ProcessInfo;
22
use crate::util::bytify;
3-
use crate::{column_default, Column};
3+
use crate::{Column, column_default};
44
use std::cmp;
55
use std::collections::HashMap;
66

@@ -30,9 +30,8 @@ impl InvoluntaryContextSw {
3030
impl Column for InvoluntaryContextSw {
3131
fn add(&mut self, proc: &ProcessInfo) {
3232
let (fmt_content, raw_content) = if let Some(ref status) = proc.curr_status {
33-
if status.nonvoluntary_ctxt_switches.is_some()
34-
{
35-
let sw = status.nonvoluntary_ctxt_switches.unwrap();
33+
if let Some(nonvoluntary_ctxt_switches) = status.nonvoluntary_ctxt_switches {
34+
let sw = nonvoluntary_ctxt_switches;
3635
(bytify(sw), sw)
3736
} else {
3837
(String::new(), 0)

src/columns/read_bytes.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::process::ProcessInfo;
22
use crate::util::bytify;
3-
use crate::{column_default, Column};
3+
use crate::{Column, column_default};
44
use std::cmp;
55
use std::collections::HashMap;
66

@@ -29,12 +29,11 @@ impl ReadBytes {
2929
#[cfg(any(target_os = "linux", target_os = "android"))]
3030
impl Column for ReadBytes {
3131
fn add(&mut self, proc: &ProcessInfo) {
32-
let (fmt_content, raw_content) = if proc.curr_io.is_some() && proc.prev_io.is_some() {
32+
let (fmt_content, raw_content) = if let Some(curr_io) = proc.curr_io
33+
&& let Some(prev_io) = proc.prev_io
34+
{
3335
let interval_ms = proc.interval.as_secs() + u64::from(proc.interval.subsec_millis());
34-
let io = (proc.curr_io.as_ref().unwrap().read_bytes
35-
- proc.prev_io.as_ref().unwrap().read_bytes)
36-
* 1000
37-
/ interval_ms;
36+
let io = (curr_io.read_bytes - prev_io.read_bytes) * 1000 / interval_ms;
3837
(bytify(io), io)
3938
} else {
4039
(String::new(), 0)

src/columns/voluntary_context_sw.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::process::ProcessInfo;
22
use crate::util::bytify;
3-
use crate::{column_default, Column};
3+
use crate::{Column, column_default};
44
use std::cmp;
55
use std::collections::HashMap;
66

@@ -30,9 +30,8 @@ impl VoluntaryContextSw {
3030
impl Column for VoluntaryContextSw {
3131
fn add(&mut self, proc: &ProcessInfo) {
3232
let (fmt_content, raw_content) = if let Some(ref status) = proc.curr_status {
33-
if status.voluntary_ctxt_switches.is_some()
34-
{
35-
let sw = status.voluntary_ctxt_switches.unwrap();
33+
if let Some(voluntary_ctxt_switches) = status.voluntary_ctxt_switches {
34+
let sw = voluntary_ctxt_switches;
3635
(bytify(sw), sw)
3736
} else {
3837
(String::new(), 0)
@@ -51,8 +50,7 @@ impl Column for VoluntaryContextSw {
5150
#[cfg(target_os = "freebsd")]
5251
impl Column for VoluntaryContextSw {
5352
fn add(&mut self, proc: &ProcessInfo) {
54-
let raw_content =
55-
proc.curr_proc.info.rusage.nvcsw as u64;
53+
let raw_content = proc.curr_proc.info.rusage.nvcsw as u64;
5654
let fmt_content = bytify(raw_content);
5755

5856
self.fmt_contents.insert(proc.pid, fmt_content);

src/columns/write_bytes.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::process::ProcessInfo;
22
use crate::util::bytify;
3-
use crate::{column_default, Column};
3+
use crate::{Column, column_default};
44
use std::cmp;
55
use std::collections::HashMap;
66

@@ -29,12 +29,11 @@ impl WriteBytes {
2929
#[cfg(any(target_os = "linux", target_os = "android"))]
3030
impl Column for WriteBytes {
3131
fn add(&mut self, proc: &ProcessInfo) {
32-
let (fmt_content, raw_content) = if proc.curr_io.is_some() && proc.prev_io.is_some() {
32+
let (fmt_content, raw_content) = if let Some(curr_io) = proc.curr_io
33+
&& let Some(prev_io) = proc.prev_io
34+
{
3335
let interval_ms = proc.interval.as_secs() + u64::from(proc.interval.subsec_millis());
34-
let io = (proc.curr_io.as_ref().unwrap().write_bytes
35-
- proc.prev_io.as_ref().unwrap().write_bytes)
36-
* 1000
37-
/ interval_ms;
36+
let io = (curr_io.write_bytes - prev_io.write_bytes) * 1000 / interval_ms;
3837
(bytify(io), io)
3938
} else {
4039
(String::new(), 0)

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use console::Term;
2222
use std::cmp;
2323
use std::collections::HashMap;
2424
use std::fs;
25-
use std::io::{stdout, Read};
25+
use std::io::{Read, stdout};
2626
use std::path::PathBuf;
2727
use std::time::Instant;
2828
use unicode_width::UnicodeWidthStr;

src/opt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use anyhow::{anyhow, Error};
2-
use clap::builder::styling::{AnsiColor, Effects, Styles};
1+
use anyhow::{Error, anyhow};
32
use clap::CommandFactory;
3+
use clap::builder::styling::{AnsiColor, Effects, Styles};
44
use clap::{Parser, ValueEnum};
55
use clap_complete::Shell;
66
use std::path::{Path, PathBuf};

src/process/linux.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use procfs::process::{FDInfo, Io, Process, Stat, Status, TasksIter};
21
use procfs::ProcError;
32
use procfs::ProcessCGroup;
3+
use procfs::process::{FDInfo, Io, Process, Stat, Status, TasksIter};
44
use std::collections::HashMap;
55
use std::path::PathBuf;
66
use std::thread;
@@ -90,7 +90,7 @@ pub fn collect_proc(
9090
let mut base_tasks = HashMap::new();
9191
let mut ret = Vec::new();
9292

93-
let all_proc = if let Some(ref x) = procfs_path {
93+
let all_proc = if let Some(x) = procfs_path {
9494
procfs::process::all_processes_with_root(x)
9595
} else {
9696
procfs::process::all_processes()

0 commit comments

Comments
 (0)