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

Fix nightly build #102

Merged
merged 4 commits into from
Mar 13, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading