1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

Merge pull request #3350 from tertsdiepraam/msrv-1.56

MSRV 1.56
This commit is contained in:
Sylvestre Ledru 2022-04-02 21:46:41 +02:00 committed by GitHub
commit 7debdbbbaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 13 deletions

View file

@ -1 +1 @@
msrv = "1.54.0"
msrv = "1.56.0"

View file

@ -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

View file

@ -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.

View file

@ -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<usize>, key: Option<usize>) -> UResult<usize> {
/// Parse the specified field string as a natural number and return
/// the zero-based field number.
fn parse_field_number(value: &str) -> UResult<usize> {
// 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::<usize>().err().unwrap();
match value.parse::<usize>() {
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()),

View file

@ -221,11 +221,7 @@ impl Utmpx {
pub fn canon_host(&self) -> IOResult<String> {
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;