diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1e5f354..0c87b60 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,8 +15,6 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Use Rust 1.53 - run: rustup install 1.53 - name: Run Rustfmt run: cargo fmt -- --check - name: Run Clippy @@ -43,7 +41,7 @@ jobs: - run: cargo run --bin simple-factory - run: cargo run --bin singleton-local - run: cargo run --bin singleton-lazy - # - run: cargo run --bin singleton-mutex # Requires Rust 1.63 + - run: cargo run --bin singleton-mutex - run: cargo run --bin singleton-once - run: cargo run --bin singleton-logger - run: cargo run --bin static-creation-method diff --git a/Cargo.toml b/Cargo.toml index 526310b..dfc814a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "2" members = [ "behavioral/chain-of-responsibility", @@ -30,3 +31,6 @@ members = [ "structural/flyweight", "structural/proxy", ] + +[patch.crates-io] +draw = { git = "https://github.com/fadeevab/draw", branch = "master" } diff --git a/README.md b/README.md index cc4ee55..e897fe7 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The repository is developed to be a part of the ## 🔧 Requirements -These examples have been tested with a _stable_ `rustc 1.62` (2021 edition). +These examples have been tested with a _stable_ `rustc 1.82` (2021 edition). All examples can be launched via the command line, using `cargo` as follows: @@ -61,7 +61,7 @@ cargo run --bin prototype cargo run --bin simple-factory cargo run --bin singleton-local cargo run --bin singleton-lazy -cargo run --bin singleton-mutex # Requires Rust 1.63 +cargo run --bin singleton-mutex cargo run --bin singleton-once cargo run --bin singleton-logger cargo run --bin static-creation-method diff --git a/creational/singleton/how-to-create/README.md b/creational/singleton/how-to-create/README.md index a771a4d..ef4123f 100644 --- a/creational/singleton/how-to-create/README.md +++ b/creational/singleton/how-to-create/README.md @@ -97,8 +97,7 @@ cargo run --bin singleton-once ⚠ Starting with `rustc 1.63`. > Starting with `Rust 1.63`, it can be easier to work with global mutable -> singletons, although it's still preferable to avoid global variables in most -> cases. +> singletons. > > Now that `Mutex::new` is `const`, you can use global static `Mutex` locks > without needing lazy initialization. diff --git a/creational/singleton/how-to-create/mutex.rs b/creational/singleton/how-to-create/mutex.rs index 5cef072..787b7d2 100644 --- a/creational/singleton/how-to-create/mutex.rs +++ b/creational/singleton/how-to-create/mutex.rs @@ -2,8 +2,7 @@ //! https://stackoverflow.com/questions/27791532/how-do-i-create-a-global-mutable-singleton //! //! Starting with Rust 1.63, it can be easier to work with global mutable -//! singletons, although it's still preferable to avoid global variables in most -//! cases. +//! singletons. //! //! Now that `Mutex::new` is `const`, you can use global static `Mutex` locks //! without needing lazy initialization. diff --git a/structural/bridge/main.rs b/structural/bridge/main.rs index ff6cf61..d04e47e 100644 --- a/structural/bridge/main.rs +++ b/structural/bridge/main.rs @@ -1,3 +1,4 @@ +#![allow(unused)] mod device; mod remotes; @@ -13,11 +14,13 @@ fn test_device(device: impl Device + Clone) { println!("Tests with basic remote."); let mut basic_remote = BasicRemote::new(device.clone()); basic_remote.power(); + basic_remote.volume_up(); basic_remote.device().print_status(); println!("Tests with advanced remote."); let mut advanced_remote = AdvancedRemote::new(device); advanced_remote.power(); - advanced_remote.mute(); + advanced_remote.volume_down(); + advanced_remote.mute(); // Extended functionality of the advanced remote. advanced_remote.device().print_status(); } diff --git a/structural/decorator/main.rs b/structural/decorator/main.rs index a92938c..c248efa 100644 --- a/structural/decorator/main.rs +++ b/structural/decorator/main.rs @@ -6,7 +6,7 @@ fn main() { // A buffered reader decorates a vector reader which wraps input data. let mut input = BufReader::new(Cursor::new("Input data")); - input.read(&mut buf).ok(); + input.read_exact(&mut buf).ok(); print!("Read from a buffered reader: ");