Skip to content

Commit

Permalink
Merge pull request #102 from mgeisler/fix-nightly-build
Browse files Browse the repository at this point in the history
Fix nightly build
  • Loading branch information
mgeisler committed Mar 13, 2024
2 parents e584c54 + 62fc0a2 commit d85d40f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
strategy:
matrix:
rust:
- 1.56
- stable
- nightly
os:
Expand All @@ -27,6 +26,7 @@ jobs:
exclude:
- rust: nightly
os: windows-latest
fail-fast: false
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -46,6 +46,22 @@ jobs:
if: matrix.rust == 'nightly'
run: cargo check --all-targets

msrv:
name: Build MSRV
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Rust
run: rustup default 1.56

- uses: Swatinem/rust-cache@v2

- name: Build
run: cargo build

build-documentation:
name: Build documentation
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ keywords = ["random", "text", "markov", "typography"]
categories = ["text-processing"]
license = "MIT"
edition = "2021"
rust-version = "1.56"

[dependencies]
rand = {version = "0.8.5", default-features = false, features = ["alloc"]}
Expand Down
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl<'a> MarkovChain<'a> {
let words = sentence.split_whitespace().collect::<Vec<&str>>();
for window in words.windows(3) {
let (a, b, c) = (window[0], window[1], window[2]);
self.map.entry((a, b)).or_insert_with(Vec::new).push(c);
self.map.entry((a, b)).or_default().push(c);
}
// Sync the keys with the current map.
self.keys = self.map.keys().cloned().collect();
Expand Down Expand Up @@ -556,8 +556,7 @@ pub fn lipsum_title() -> String {
#[cfg(test)]
mod tests {
use super::*;
use rand::{thread_rng, SeedableRng};
use rand_chacha::ChaCha20Rng;
use rand::thread_rng;

#[test]
fn starts_with_lorem_ipsum() {
Expand Down

0 comments on commit d85d40f

Please sign in to comment.