Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump the MSRV to 1.56 #1053

Merged
merged 4 commits into from May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/test.yml
Expand Up @@ -32,9 +32,8 @@ jobs:
- run: cargo test --doc --all-features --color=always -- --color=always

# later this may be able to be included with the below
# kept seperate for now as the following don't compile on 1.38.0
# * rkyv
# * criterion
# kept separate for now as the following don't compile on 1.56.1
# * arbitrary
rust_msrv:
strategy:
matrix:
Expand All @@ -44,11 +43,11 @@ jobs:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.38.0
toolchain: 1.56.1
- uses: Swatinem/rust-cache@v2
# run --lib and --doc to avoid the long running integration tests which are run elsewhere
- run: cargo test --lib --features unstable-locales,wasmbind,oldtime,clock,rustc-serialize,winapi --color=always -- --color=always
- run: cargo test --doc --features unstable-locales,wasmbind,oldtime,clock,rustc-serialize,winapi --color=always -- --color=always
- run: cargo test --lib --features unstable-locales,wasmbind,oldtime,clock,rustc-serialize,winapi,serde --color=always -- --color=always
- run: cargo test --doc --features unstable-locales,wasmbind,oldtime,clock,rustc-serialize,winapi,serde --color=always -- --color=always

rust_versions:
strategy:
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Expand Up @@ -11,6 +11,7 @@ readme = "README.md"
license = "MIT/Apache-2.0"
exclude = ["/ci/*"]
edition = "2018"
djc marked this conversation as resolved.
Show resolved Hide resolved
rust-version = "1.56.0"

[lib]
name = "chrono"
Expand Down
1 change: 0 additions & 1 deletion clippy.toml

This file was deleted.

1 change: 1 addition & 0 deletions src/format/mod.rs
Expand Up @@ -356,6 +356,7 @@ impl ParseError {
}

/// The category of parse error
#[allow(clippy::manual_non_exhaustive)]
#[derive(Debug, Clone, PartialEq, Eq, Copy, Hash)]
pub enum ParseErrorKind {
/// Given field is out of permitted range.
Expand Down
1 change: 1 addition & 0 deletions src/format/parsed.rs
Expand Up @@ -22,6 +22,7 @@ use crate::{Datelike, Timelike};
///
/// - `to_*` methods try to make a concrete date and time value out of set fields.
/// It fully checks any remaining out-of-range conditions and inconsistent/impossible fields.
#[allow(clippy::manual_non_exhaustive)]
#[derive(Clone, PartialEq, Eq, Debug, Default, Hash)]
pub struct Parsed {
/// Year.
Expand Down
9 changes: 1 addition & 8 deletions src/format/scan.rs
Expand Up @@ -313,14 +313,7 @@ where
/// [RFC 2822 Section 4.3]: https://tools.ietf.org/html/rfc2822#section-4.3
pub(super) fn timezone_offset_2822(s: &str) -> ParseResult<(&str, Option<i32>)> {
// tries to parse legacy time zone names
let upto = s
.as_bytes()
.iter()
.position(|&c| match c {
b'a'..=b'z' | b'A'..=b'Z' => false,
_ => true,
})
.unwrap_or(s.len());
let upto = s.as_bytes().iter().position(|&c| !c.is_ascii_alphabetic()).unwrap_or(s.len());
if upto > 0 {
let name = &s.as_bytes()[..upto];
let s = &s[upto..];
Expand Down
12 changes: 0 additions & 12 deletions src/lib.rs
Expand Up @@ -513,15 +513,3 @@ pub use naive::__BenchYearFlags;
pub mod serde {
pub use super::datetime::serde::*;
}

/// MSRV 1.42
#[cfg(test)]
#[macro_export]
macro_rules! matches {
($expression:expr, $(|)? $( $pattern:pat )|+ $( if $guard: expr )? $(,)?) => {
match $expression {
$( $pattern )|+ $( if $guard )? => true,
_ => false
}
}
}
2 changes: 1 addition & 1 deletion src/naive/date.rs
Expand Up @@ -2249,7 +2249,7 @@ mod tests {
assert_eq!(
NaiveDate::from_ymd_opt(2022, 8, 3)
.unwrap()
.checked_sub_months(Months::new((i32::MIN as i64).abs() as u32 + 1)),
.checked_sub_months(Months::new(i32::MIN.unsigned_abs() + 1)),
None
);

Expand Down
1 change: 0 additions & 1 deletion src/offset/local/tz_info/rule.rs
Expand Up @@ -777,7 +777,6 @@ mod tests {
use super::super::timezone::Transition;
use super::super::{Error, TimeZone};
use super::{AlternateTime, LocalTimeType, RuleDay, TransitionRule};
use crate::matches;

#[test]
fn test_quoted() -> Result<(), Error> {
Expand Down
1 change: 0 additions & 1 deletion src/offset/local/tz_info/timezone.rs
Expand Up @@ -632,7 +632,6 @@ const SECONDS_PER_28_DAYS: i64 = SECONDS_PER_DAY * 28;
mod tests {
use super::super::Error;
use super::{LeapSecond, LocalTimeType, TimeZone, TimeZoneName, Transition, TransitionRule};
use crate::matches;

#[test]
fn test_no_dst() -> Result<(), Error> {
Expand Down
4 changes: 2 additions & 2 deletions src/offset/local/unix.rs
Expand Up @@ -88,7 +88,7 @@ impl Default for Cache {
fn default() -> Cache {
// default to UTC if no local timezone can be found
let env_tz = env::var("TZ").ok();
let env_ref = env_tz.as_ref().map(|s| s.as_str());
let env_ref = env_tz.as_deref();
Cache {
last_checked: SystemTime::now(),
source: Source::new(env_ref),
Expand All @@ -114,7 +114,7 @@ impl Cache {
Ok(d) if d.as_secs() < 1 => (),
Ok(_) | Err(_) => {
let env_tz = env::var("TZ").ok();
let env_ref = env_tz.as_ref().map(|s| s.as_str());
let env_ref = env_tz.as_deref();
let new_source = Source::new(env_ref);

let out_of_date = match (&self.source, &new_source) {
Expand Down