Skip to content

Fix clippy errors + bump up a supported rust version to the latest stable #17

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

Merged
merged 1 commit into from
Jan 1, 2025
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
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"

members = [
"behavioral/chain-of-responsibility",
Expand Down Expand Up @@ -30,3 +31,6 @@ members = [
"structural/flyweight",
"structural/proxy",
]

[patch.crates-io]
draw = { git = "https://github.com/fadeevab/draw", branch = "master" }
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions creational/singleton/how-to-create/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions creational/singleton/how-to-create/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion structural/bridge/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(unused)]
mod device;
mod remotes;

Expand All @@ -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();
}
2 changes: 1 addition & 1 deletion structural/decorator/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: ");

Expand Down
Loading