From 3629421e1776668aece281c759bd401e9e961040 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 1 Apr 2022 18:43:05 +0200 Subject: [PATCH 1/3] Bump MSRV to 1.56 --- .clippy.toml | 2 +- .github/workflows/CICD.yml | 2 +- README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.clippy.toml b/.clippy.toml index 0f31b88d4..0d369b50f 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -1 +1 @@ -msrv = "1.54.0" +msrv = "1.56.0" diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index d2cf890a2..08803afb1 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -13,7 +13,7 @@ env: PROJECT_NAME: coreutils PROJECT_DESC: "Core universal (cross-platform) utilities" PROJECT_AUTH: "uutils" - RUST_MIN_SRV: "1.54.0" ## MSRV v1.54.0 + RUST_MIN_SRV: "1.56.0" ## MSRV v1.56.0 # * style job configuration STYLE_FAIL_ON_FAULT: true ## (bool) fail the build if a style job contains a fault (error or warning); may be overridden on a per-job basis diff --git a/README.md b/README.md index 6b4f45a4a..e00a01ec5 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ Both can also be generated locally, the instructions for that can be found in th ### Rust Version uutils follows Rust's release channels and is tested against stable, beta and nightly. -The current oldest supported version of the Rust compiler is `1.54`. +The current oldest supported version of the Rust compiler is `1.56`. On both Windows and Redox, only the nightly version is tested currently. From 4701ea0c953746859c6c74e799b05089fa05702b Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 1 Apr 2022 18:46:12 +0200 Subject: [PATCH 2/3] uucore: use split_once in canon_host --- src/uucore/src/lib/features/utmpx.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/uucore/src/lib/features/utmpx.rs b/src/uucore/src/lib/features/utmpx.rs index c82fd35ef..2a0e2810b 100644 --- a/src/uucore/src/lib/features/utmpx.rs +++ b/src/uucore/src/lib/features/utmpx.rs @@ -221,11 +221,7 @@ impl Utmpx { pub fn canon_host(&self) -> IOResult { let host = self.host(); - // TODO: change to use `split_once` when MSRV hits 1.52.0 - // let (hostname, display) = host.split_once(':').unwrap_or((&host, "")); - let mut h = host.split(':'); - let hostname = h.next().unwrap_or(&host); - let display = h.next().unwrap_or(""); + let (hostname, display) = host.split_once(':').unwrap_or((&host, "")); if !hostname.is_empty() { extern crate dns_lookup; From 0fc667730d7619f5cfa8c45d88e16dff691740a5 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 1 Apr 2022 18:50:42 +0200 Subject: [PATCH 3/3] join: fix workaround for IntErrorKind In Rust versions before 1.55, there was no enum for parse errors. With the bump of the MSRV to 1.56 we can simplify this. --- src/uu/join/src/join.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/uu/join/src/join.rs b/src/uu/join/src/join.rs index 1d306415b..ef19fe328 100644 --- a/src/uu/join/src/join.rs +++ b/src/uu/join/src/join.rs @@ -18,6 +18,7 @@ use std::error::Error; use std::fmt::Display; use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, BufWriter, Split, Stdin, Write}; +use std::num::IntErrorKind; #[cfg(unix)] use std::os::unix::ffi::OsStrExt; use uucore::display::Quotable; @@ -965,13 +966,9 @@ fn get_field_number(keys: Option, key: Option) -> UResult { /// Parse the specified field string as a natural number and return /// the zero-based field number. fn parse_field_number(value: &str) -> UResult { - // TODO: use ParseIntError.kind() once MSRV >= 1.55 - // For now, store an overflow Err from parsing a value 10x 64 bit usize::MAX - // Adapted from https://github.com/rust-lang/rust/issues/22639 - let overflow = "184467440737095516150".parse::().err().unwrap(); match value.parse::() { Ok(result) if result > 0 => Ok(result - 1), - Err(ref e) if *e == overflow => Ok(usize::MAX), + Err(e) if e.kind() == &IntErrorKind::PosOverflow => Ok(usize::MAX), _ => Err(USimpleError::new( 1, format!("invalid field number: {}", value.quote()),