Skip to content

Commit

Permalink
Bump Rust edition to "2021"
Browse files Browse the repository at this point in the history
Since the edition shipped with the Rust 1.56 toolchain, this also
raises the MSRV to 1.56, which also is the first version to understand
the `package.rust-version` setting, which is now present in all
crates' `Cargo.toml` file.
  • Loading branch information
Andreas Rottmann committed Feb 5, 2024
1 parent 28b0e07 commit bf47a7c
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 31 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,19 @@ jobs:
run: cargo test --all-features --all-targets

msrv-check:
# We require at least Rust 1.45, so we can use proc macros in
# expression position without resorting to the `proc-macro-hack`
# crate.
name: "MSRV (1.45.0) compile check"
# We require at least Rust 1.56, so we can use a current version
# of the `proc-macro2` crate, which has an MSRV of 1.56, as of
# version 1.0.69.
name: "MSRV (1.56) compile check"
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install 1.45 toolchain
uses: dtolnay/rust-toolchain@1.45.0
- name: Install 1.56 toolchain
uses: dtolnay/rust-toolchain@1.56

# We use the git CLI here, since otherwise cargo fails with
# "error reading from the zlib stream; class=Zlib (5)", see
# <https://github.com/rust-lang/cargo/issues/10303>.
- name: Run cargo build
run: CARGO_NET_GIT_FETCH_WITH_CLI=true cargo build
working-directory: ./msrv-test

lints:
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ members = [
"lexpr-macros",
"serde-lexpr",
]
resolver = "2"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# lexpr: S-expressions for Rust [![Build Status]][gh-actions] [![Codecov]][codecov] [![Rustc Version 1.45+]][rustc]
# lexpr: S-expressions for Rust [![Build Status]][gh-actions] [![Codecov]][codecov] [![Rustc Version 1.56+]][rustc]

[Build Status]: https://github.com/rotty/lexpr-rs/workflows/CI/badge.svg
[gh-actions]: https://github.com/rotty/lexpr-rs/actions
[codecov]: https://codecov.io/github/rotty/lexpr-rs/coverage.svg?branch=master
[Rustc Version 1.45+]: https://img.shields.io/badge/rustc-1.45+-lightgray.svg
[rustc]: https://blog.rust-lang.org/2020/07/16/Rust-1.45.0.html
[Rustc Version 1.56+]: https://img.shields.io/badge/rustc-1.56+-lightgray.svg
[rustc]: https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html

This repository hosts the following crates:

Expand Down
3 changes: 2 additions & 1 deletion lexpr-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ version = "0.2.2"
authors = ["Andreas Rottmann <[email protected]>"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/rotty/lexpr-rs"
edition = "2018"
edition = "2021"
rust-version = "1.56"

[lib]
proc-macro = true
Expand Down
5 changes: 2 additions & 3 deletions lexpr-macros/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ impl Parser {
TokenTree::Punct(punct) => match punct.as_char() {
'#' => self.parse_octothorpe(),
',' => Ok(Value::Unquoted(self.token()?.clone())),
'!' | '$' | '%' | '&' | '*' | '+' | '-' | '.' | '/' | ':' | '<' | '=' | '>'
| '?' | '@' | '^' | '_' | '~' => {
let c = punct.as_char(); // TODO: Use `@` pattern match on MSRV bump
c @ ('!' | '$' | '%' | '&' | '*' | '+' | '-' | '.' | '/' | ':' | '<' | '='
| '>' | '?' | '@' | '^' | '_' | '~') => {
match punct.spacing() {
// TODO: A lone '.' is not an identfier
Spacing::Joint => Ok(Value::Symbol(self.parse_identifier(c.to_string()))),
Expand Down
3 changes: 2 additions & 1 deletion lexpr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ readme = "README.md"
documentation = "https://docs.rs/lexpr/"
keywords = ["lisp", "s-expression", "sexp", "sexpr"]
categories = ["encoding", "data-structures", "parser-implementations"]
edition = "2018"
edition = "2021"
rust-version = "1.56"

[features]
default = ["fast-float-parsing"]
Expand Down
8 changes: 4 additions & 4 deletions lexpr/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# lexpr: S-expressions for Rust [![Latest Version]][crates.io] [![Rustc Version 1.45+]][rustc]
# lexpr: S-expressions for Rust [![Latest Version]][crates.io] [![Rustc Version 1.56+]][rustc]

[Latest Version]: https://img.shields.io/crates/v/lexpr.svg
[crates.io]: https://crates.io/crates/lexpr
[Rustc Version 1.45+]: https://img.shields.io/badge/rustc-1.45+-lightgray.svg
[rustc]: https://blog.rust-lang.org/2020/07/16/Rust-1.45.0.html
[Rustc Version 1.56+]: https://img.shields.io/badge/rustc-1.56+-lightgray.svg
[rustc]: https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html

You may be looking for:

Expand Down Expand Up @@ -54,7 +54,7 @@ document.

`lexpr` is CI-tested on current stable, beta and nightly channels of
Rust. Additionally, it is made sure that the code still compiles on
Rust 1.45.0. However, no tests are run for that build.
Rust 1.56.0. However, no tests are run for that build.

## Supported Lisp dialects

Expand Down
4 changes: 1 addition & 3 deletions lexpr/src/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1276,9 +1276,7 @@ impl<'de, R: Read<'de>> Parser<R> {
fn f64_from_parts(&mut self, pos: bool, significand: u64, mut exponent: i32) -> Result<f64> {
let mut f = significand as f64;
loop {
// TODO: Use `unsigned_abs` here after bumping MSRV to 1.51+.
#[allow(clippy::cast_abs_to_unsigned)]
match POW10.get(exponent.abs() as usize) {
match POW10.get(exponent.unsigned_abs() as usize) {
Some(&pow) => {
if exponent >= 0 {
f *= pow;
Expand Down
2 changes: 1 addition & 1 deletion lexpr/tests/print-parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fn test_improper_lists() {

#[test]
fn test_chars_elisp() {
for (value, printed) in vec![
for (value, printed) in [
(sexp!('x'), "?x"),
(sexp!('\\'), "?\\\\"),
(sexp!('\u{1B}'), "?\\x1b"),
Expand Down
2 changes: 1 addition & 1 deletion msrv-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "msrv-test"
version = "0.0.1"
authors = ["Andreas Rottmann <[email protected]>"]
edition = "2018"
edition = "2021"

[dependencies]
lexpr = { path = "../lexpr" }
Expand Down
3 changes: 2 additions & 1 deletion serde-lexpr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ readme = "README.md"
documentation = "https://docs.rs/serde-lexpr/"
keywords = ["lisp", "s-expression", "sexp", "sexpr", "serde"]
categories = ["encoding", "data-structures", "parser-implementations"]
edition = "2018"
edition = "2021"
rust-version = "1.56"

[dependencies]
lexpr = { version = "0.2.7", path = "../lexpr" }
Expand Down
6 changes: 3 additions & 3 deletions serde-lexpr/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# serde-lexpr: Serde S-expressions [![Latest Version]][crates.io] [![Rustc Version 1.45+]][rustc]
# serde-lexpr: Serde S-expressions [![Latest Version]][crates.io] [![Rustc Version 1.56+]][rustc]

[Latest Version]: https://img.shields.io/crates/v/serde-lexpr.svg
[crates.io]: https://crates.io/crates/serde-lexpr
[Rustc Version 1.45+]: https://img.shields.io/badge/rustc-1.45+-lightgray.svg
[rustc]: https://blog.rust-lang.org/2020/07/16/Rust-1.45.0.html
[Rustc Version 1.56+]: https://img.shields.io/badge/rustc-1.56+-lightgray.svg
[rustc]: https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html

You may be looking for:

Expand Down

0 comments on commit bf47a7c

Please sign in to comment.