Skip to content

Commit 6138e7c

Browse files
jedel1043raskad
andauthored
Enable merge queue (#38)
* Enable merge queue * Update CI action * Trigger actions * Remove pre-ci from actions * Update ci.yml * Fix clippy lints * Test if the msrv is tested correctly in the ci * Revert latest commit * Update criterion to v0.5 * Increase msrv to 1.60 * Set MSRV to 1.64 * Fix clippy lints * Fix clippy lints --------- Co-authored-by: raskad <32105367+raskad@users.noreply.github.com>
1 parent c15c208 commit 6138e7c

File tree

9 files changed

+23
-33
lines changed

9 files changed

+23
-33
lines changed

.clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
msrv = "1.36.0"
1+
msrv = "1.64.0"

.github/workflows/ci.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
name: CI
22

33
on:
4-
push:
54
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
610
workflow_dispatch:
711
schedule: [cron: "40 1 * * *"]
12+
merge_group:
13+
types: [checks_requested]
814

915
permissions:
1016
contents: read
@@ -13,13 +19,8 @@ env:
1319
RUSTFLAGS: -Dwarnings
1420

1521
jobs:
16-
pre_ci:
17-
uses: dtolnay/.github/.github/workflows/pre_ci.yml@master
18-
1922
test:
2023
name: Rust ${{matrix.rust}}
21-
needs: pre_ci
22-
if: needs.pre_ci.outputs.continue
2324
runs-on: ubuntu-latest
2425
strategy:
2526
fail-fast: false
@@ -40,21 +41,17 @@ jobs:
4041
if: matrix.rust == 'nightly'
4142

4243
msrv:
43-
name: Rust 1.36.0
44-
needs: pre_ci
45-
if: needs.pre_ci.outputs.continue
44+
name: Rust 1.64.0
4645
runs-on: ubuntu-latest
4746
timeout-minutes: 45
4847
steps:
4948
- uses: actions/checkout@v3
50-
- uses: dtolnay/rust-toolchain@1.36.0
49+
- uses: dtolnay/rust-toolchain@1.64.0
5150
- run: cargo build
5251
- run: cargo build --features small
5352

5453
miri:
5554
name: Miri
56-
needs: pre_ci
57-
if: needs.pre_ci.outputs.continue
5855
runs-on: ubuntu-latest
5956
timeout-minutes: 45
6057
steps:
@@ -67,7 +64,6 @@ jobs:
6764
clippy:
6865
name: Clippy
6966
runs-on: ubuntu-latest
70-
if: github.event_name != 'pull_request'
7167
timeout-minutes: 45
7268
steps:
7369
- uses: actions/checkout@v3
@@ -77,7 +73,6 @@ jobs:
7773
outdated:
7874
name: Outdated
7975
runs-on: ubuntu-latest
80-
if: github.event_name != 'pull_request'
8176
timeout-minutes: 45
8277
steps:
8378
- uses: actions/checkout@v3
@@ -87,13 +82,10 @@ jobs:
8782

8883
fuzz:
8984
name: Fuzz
90-
needs: pre_ci
91-
if: needs.pre_ci.outputs.continue
9285
runs-on: ubuntu-latest
9386
timeout-minutes: 45
9487
steps:
9588
- uses: actions/checkout@v3
9689
- uses: dtolnay/rust-toolchain@nightly
9790
- uses: dtolnay/install@cargo-fuzz
9891
- run: cargo fuzz check
99-

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ exclude = ["performance.png", "chart/**"]
1010
keywords = ["float"]
1111
license = "Apache-2.0 OR BSL-1.0"
1212
repository = "https://github.com/boa-dev/ryu-js"
13-
rust-version = "1.36"
13+
rust-version = "1.64"
1414

1515
[features]
1616
# Use smaller lookup tables. Instead of storing every required power of
@@ -26,7 +26,7 @@ no-panic = { version = "0.1", optional = true }
2626
num_cpus = "1.8"
2727
rand = "0.8"
2828
rand_xorshift = "0.3"
29-
criterion = "0.4"
29+
criterion = "0.5"
3030

3131
[lib]
3232
bench = false

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ under the creative commons CC-BY-SA license.
1515
This Rust implementation is a line-by-line port of Ulf Adams' implementation in
1616
C, [https://github.com/ulfjack/ryu][upstream].
1717

18-
*Requirements: this crate supports any compiler version back to rustc 1.36; it
18+
*Requirements: this crate supports any compiler version back to rustc 1.64; it
1919
uses nothing from the Rust standard library so is usable from no_std crates.*
2020

2121
[paper]: https://dl.acm.org/citation.cfm?id=3192369

src/buffer/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ impl Buffer {
7474
#[cfg_attr(feature = "no-panic", no_panic)]
7575
pub fn format_finite<F: Float>(&mut self, f: F) -> &str {
7676
unsafe {
77-
let n = f.write_to_ryu_buffer(self.bytes.as_mut_ptr() as *mut u8);
77+
let n = f.write_to_ryu_buffer(self.bytes.as_mut_ptr().cast::<u8>());
7878
debug_assert!(n <= self.bytes.len());
79-
let slice = slice::from_raw_parts(self.bytes.as_ptr() as *const u8, n);
79+
let slice = slice::from_raw_parts(self.bytes.as_ptr().cast::<u8>(), n);
8080
str::from_utf8_unchecked(slice)
8181
}
8282
}
@@ -87,7 +87,7 @@ impl Copy for Buffer {}
8787
impl Clone for Buffer {
8888
#[inline]
8989
fn clone(&self) -> Self {
90-
Buffer::new()
90+
*self
9191
}
9292
}
9393

src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414
//! # Example
1515
//!
1616
//! ```
17-
//! fn main() {
18-
//! let mut buffer = ryu_js::Buffer::new();
19-
//! let printed = buffer.format(1.234);
20-
//! assert_eq!(printed, "1.234");
21-
//! }
17+
//! let mut buffer = ryu_js::Buffer::new();
18+
//! let printed = buffer.format(1.234);
19+
//! assert_eq!(printed, "1.234");
2220
//! ```
2321
//!
2422
//! ## Performance (lower is better)

src/s2d.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn s2d(buffer: &[u8]) -> Result<f64, Error> {
5555
i += 1;
5656
}
5757

58-
if let Some(b'e') | Some(b'E') = buffer.get(i) {
58+
if let Some(b'e' | b'E') = buffer.get(i) {
5959
e_index = i;
6060
i += 1;
6161
match buffer.get(i) {

src/s2f.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn s2f(buffer: &[u8]) -> Result<f32, Error> {
5555
i += 1;
5656
}
5757

58-
if let Some(b'e') | Some(b'E') = buffer.get(i) {
58+
if let Some(b'e' | b'E') = buffer.get(i) {
5959
e_index = i;
6060
i += 1;
6161
match buffer.get(i) {

tests/d2s_table_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ use d2s_small_table::*;
4747
#[test]
4848
fn test_compute_pow5() {
4949
for (i, entry) in DOUBLE_POW5_SPLIT.iter().enumerate() {
50-
assert_eq!(*entry, unsafe { compute_pow5(i as u32) }, "entry {}", i);
50+
assert_eq!(*entry, unsafe { compute_pow5(i as u32) }, "entry {i}");
5151
}
5252
}
5353

5454
#[test]
5555
fn test_compute_inv_pow5() {
5656
for (i, entry) in DOUBLE_POW5_INV_SPLIT[..292].iter().enumerate() {
57-
assert_eq!(*entry, unsafe { compute_inv_pow5(i as u32) }, "entry {}", i);
57+
assert_eq!(*entry, unsafe { compute_inv_pow5(i as u32) }, "entry {i}");
5858
}
5959
}

0 commit comments

Comments
 (0)