Skip to content

Commit 1135608

Browse files
committed
Fix clippy errors + bump up a supported rust version to the latest stable
1 parent d9d7226 commit 1135608

File tree

7 files changed

+14
-11
lines changed

7 files changed

+14
-11
lines changed

.github/workflows/test.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@v2
18-
- name: Use Rust 1.53
19-
run: rustup install 1.53
2018
- name: Run Rustfmt
2119
run: cargo fmt -- --check
2220
- name: Run Clippy
@@ -43,7 +41,7 @@ jobs:
4341
- run: cargo run --bin simple-factory
4442
- run: cargo run --bin singleton-local
4543
- run: cargo run --bin singleton-lazy
46-
# - run: cargo run --bin singleton-mutex # Requires Rust 1.63
44+
- run: cargo run --bin singleton-mutex
4745
- run: cargo run --bin singleton-once
4846
- run: cargo run --bin singleton-logger
4947
- run: cargo run --bin static-creation-method

Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[workspace]
2+
resolver = "2"
23

34
members = [
45
"behavioral/chain-of-responsibility",
@@ -30,3 +31,6 @@ members = [
3031
"structural/flyweight",
3132
"structural/proxy",
3233
]
34+
35+
[patch.crates-io]
36+
draw = { git = "https://github.com/fadeevab/draw", branch = "master" }

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The repository is developed to be a part of the
1818

1919
## 🔧 Requirements
2020

21-
These examples have been tested with a _stable_ `rustc 1.62` (2021 edition).
21+
These examples have been tested with a _stable_ `rustc 1.82` (2021 edition).
2222

2323
All examples can be launched via the command line, using `cargo` as follows:
2424

@@ -61,7 +61,7 @@ cargo run --bin prototype
6161
cargo run --bin simple-factory
6262
cargo run --bin singleton-local
6363
cargo run --bin singleton-lazy
64-
cargo run --bin singleton-mutex # Requires Rust 1.63
64+
cargo run --bin singleton-mutex
6565
cargo run --bin singleton-once
6666
cargo run --bin singleton-logger
6767
cargo run --bin static-creation-method

creational/singleton/how-to-create/README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ cargo run --bin singleton-once
9797
⚠ Starting with `rustc 1.63`.
9898

9999
> Starting with `Rust 1.63`, it can be easier to work with global mutable
100-
> singletons, although it's still preferable to avoid global variables in most
101-
> cases.
100+
> singletons.
102101
>
103102
> Now that `Mutex::new` is `const`, you can use global static `Mutex` locks
104103
> without needing lazy initialization.

creational/singleton/how-to-create/mutex.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
//! https://stackoverflow.com/questions/27791532/how-do-i-create-a-global-mutable-singleton
33
//!
44
//! Starting with Rust 1.63, it can be easier to work with global mutable
5-
//! singletons, although it's still preferable to avoid global variables in most
6-
//! cases.
5+
//! singletons.
76
//!
87
//! Now that `Mutex::new` is `const`, you can use global static `Mutex` locks
98
//! without needing lazy initialization.

structural/bridge/main.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(unused)]
12
mod device;
23
mod remotes;
34

@@ -13,11 +14,13 @@ fn test_device(device: impl Device + Clone) {
1314
println!("Tests with basic remote.");
1415
let mut basic_remote = BasicRemote::new(device.clone());
1516
basic_remote.power();
17+
basic_remote.volume_up();
1618
basic_remote.device().print_status();
1719

1820
println!("Tests with advanced remote.");
1921
let mut advanced_remote = AdvancedRemote::new(device);
2022
advanced_remote.power();
21-
advanced_remote.mute();
23+
advanced_remote.volume_down();
24+
advanced_remote.mute(); // Extended functionality of the advanced remote.
2225
advanced_remote.device().print_status();
2326
}

structural/decorator/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn main() {
66
// A buffered reader decorates a vector reader which wraps input data.
77
let mut input = BufReader::new(Cursor::new("Input data"));
88

9-
input.read(&mut buf).ok();
9+
input.read_exact(&mut buf).ok();
1010

1111
print!("Read from a buffered reader: ");
1212

0 commit comments

Comments
 (0)