Skip to content

Commit

Permalink
MSRV of 1.34.0, bug fixes, move to alloc feature
Browse files Browse the repository at this point in the history
Previously, some components were not checked when parsing, even when
they should have been. This was more of a problem because of the use of
unchecked methods. All final parsing methods use the checked versions,
returning a component error if failing.

Error handling from parsing could/probably should be reworked in the
future at some point.

The "std" feature has been renamed to "alloc", which is the negative
equivalent. This allows for use of serde with the standard library
enabled in 1.34. This is necessary because cargo currently doesn't
support disabling a feature with another feature.
  • Loading branch information
jhpratt committed Jan 17, 2020
1 parent cf5af97 commit 54f0c87
Show file tree
Hide file tree
Showing 27 changed files with 831 additions and 609 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust: [1.40.0, stable]
rust: [1.34.0, 1.36.0, stable]
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
Expand All @@ -23,30 +23,33 @@ jobs:
toolchain: ${{ matrix.rust }}
override: true

- name: Run `cargo check --no-default-features`
# deprecated
- name: Run `cargo check --features alloc`
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features
if: matrix.rust != '1.34.0' # alloc is unstable in 1.34

- name: Run `cargo check --no-default-features --features serde`
# std, serde, deprecated
- name: Run `cargo check --features serde`
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features --features serde

- name: Run `cargo check --all-features`
# std, deprecated
- name: Run `cargo check`
uses: actions-rs/cargo@v1
with:
command: check
args: --all-features

test:
name: Test suite
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust: [1.40.0, stable]
rust: [1.34.0, 1.36.0, stable] # 1.36 is when alloc was stabilized
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
Expand All @@ -61,17 +64,17 @@ jobs:
toolchain: ${{ matrix.rust }}
override: true

- name: Run `cargo test --no-default-features`
- name: Run `cargo test --features alloc`
uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features
args: --features alloc
if: matrix.rust != '1.34.0' # alloc is unstable in 1.34

- name: Run `cargo test --all-features`
- name: Run `cargo test`
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features

fmt:
name: Formatting
Expand Down Expand Up @@ -117,8 +120,8 @@ jobs:
- name: Install clippy
run: rustup component add clippy

- name: Run `cargo clippy --all-features`
- name: Run `cargo clippy --features serde,deprecated`
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
args: --features serde,deprecated
4 changes: 2 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
toolchain: nightly # rust-lang/rust#43466, rust-lang/rust#43781
override: true

- name: Run `cargo doc --all-features`
- name: Run `cargo doc --features serde,deprecated`
uses: actions-rs/cargo@v1
with:
command: doc
args: --all-features
args: --features serde,deprecated

- name: Build & publish documentation
uses: JamesIves/github-pages-deploy-action@releases/v2
Expand Down
13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ license = "MIT OR Apache-2.0"
# TODO Add GitHub Actions badge once rust-lang/crates.io#1838 is merged.
description = "Date and time library. Fully interoperable with the standard library. Mostly compatible with #![no_std]."

[package.metadata.docs.rs]
all-features = true

[features]
default = ["std", "deprecated"]
default = ["deprecated"]
deprecated = []
std = []
alloc = ["serde/alloc"]
panicking-api = []

[dependencies]
serde = { version = "1", optional = true, default-features = false, features = ["derive", "alloc"] }
serde = { version = "1", optional = true, default-features = false, features = ["derive"] }
time-macros = { version = "0.1", path = "time-macros" }

[package.metadata.docs.rs]
all-features = true
rustversion = "1"

[workspace]
members = [
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Matrix](https://img.shields.io/badge/chat-Matrix/Riot-blue)](https://riot.im/app/#/room/!AAFrFkLHvtsXtMYRho:matrix.org)
![license](https://img.shields.io/badge/license-MIT%20or%20Apache--2-brightgreen)
![version](https://img.shields.io/crates/v/time)
![rustc 1.40.0](https://img.shields.io/badge/rustc-1.40.0-blue)
![rustc 1.34.0](https://img.shields.io/badge/rustc-1.34.0-blue)

[Documentation (master)](https://time-rs.github.io/time/time/index.html)
<br>
Expand Down
Loading

0 comments on commit 54f0c87

Please sign in to comment.