From ad64438cd4689eef3b343ba5f52ab9902708fdd8 Mon Sep 17 00:00:00 2001 From: hackerchai Date: Thu, 19 Aug 2021 10:26:31 +0800 Subject: [PATCH 1/3] feat: bump dependency version Signed-off-by: hackerchai --- Cargo.toml | 26 +++++++++++++------------- src/rbac/default_role_manager.rs | 4 ++-- src/util.rs | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 08a8e52c..1fefcbbe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,15 +14,15 @@ version = "2.0.7" [dependencies] async-std = { version = "1.9.0", optional = true } -async-trait = "0.1.48" -globset = { version = "0.4.6", optional = true } -ritelinked = { version = "0.3.0", default-features = false, features = ["ahash", "inline-more"] } -ip_network = { version = "0.3.4", optional = true } +async-trait = "0.1.51" +globset = { version = "0.4.8", optional = true } +ritelinked = { version = "0.3.1", default-features = false, features = ["ahash", "inline-more"] } +ip_network = { version = "0.4.0", optional = true } lazy_static = "1.4.0" -lru = { version = "0.6.5", optional = true } +lru = { version = "0.6.6", optional = true } parking_lot = "0.11" -regex = "1.4.5" -rhai = { version = "0.20.0", features = [ +regex = "1.5.4" +rhai = { version = "1.0.2", features = [ "sync", "only_i32", "no_function", @@ -32,12 +32,12 @@ rhai = { version = "0.20.0", features = [ "serde", "unchecked", ] } -serde = "1.0.125" +serde = "1.0.127" slog = { version = "2.7.0", optional = true } slog-async = { version = "2.6.0", optional = true } slog-term = { version = "2.8.0", optional = true } -thiserror = "1.0.24" -tokio = { version = "1.5.0", optional = true, default-features = false } +thiserror = "1.0.26" +tokio = { version = "1.10.0", optional = true, default-features = false } tokio-stream = { version = "0.1", optional = true, default-features = false } [features] @@ -56,12 +56,12 @@ watcher = [] [target.'cfg(target_arch = "wasm32")'.dev-dependencies] async-std = { version = "1.9.0", features = ["attributes"] } -serde = { version = "1.0.125", features = ["derive"] } +serde = { version = "1.0.127", features = ["derive"] } [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] async-std = { version = "1.9.0", features = ["attributes"] } -serde = { version = "1.0.125", features = ["derive"] } -tokio = { version = "1.5.0", features = ["full"] } +serde = { version = "1.0.127", features = ["derive"] } +tokio = { version = "1.10.0", features = ["full"] } [profile.release] codegen-units = 1 diff --git a/src/rbac/default_role_manager.rs b/src/rbac/default_role_manager.rs index e845ea7a..71eecf2f 100644 --- a/src/rbac/default_role_manager.rs +++ b/src/rbac/default_role_manager.rs @@ -113,7 +113,7 @@ impl DefaultRoleManager { .filter(|x| Some(x.as_str()) != domain) { for direct_role in - &self.create_role(name, Some(&domain)).read().roles + &self.create_role(name, Some(domain)).read().roles { cloned_role.add_role(Arc::clone(direct_role)); } @@ -290,7 +290,7 @@ impl Role { let not_exists = !self .roles .iter() - .any(|role| Arc::ptr_eq(&role, &other_role)); + .any(|role| Arc::ptr_eq(role, &other_role)); if not_exists { self.roles.push(other_role); diff --git a/src/util.rs b/src/util.rs index 9096e033..24b79a8a 100644 --- a/src/util.rs +++ b/src/util.rs @@ -19,7 +19,7 @@ lazy_static! { } pub fn escape_assertion(s: &str) -> String { - ESC_A.replace_all(&s, "${1}_").to_string() + ESC_A.replace_all(s, "${1}_").to_string() } pub fn remove_comment(s: &str) -> String { From 6d4b50d4a5106e14a0364c32cec945de3e8af883 Mon Sep 17 00:00:00 2001 From: hackerchai Date: Thu, 19 Aug 2021 10:27:21 +0800 Subject: [PATCH 2/3] feat: bump version 2.0.8 Signed-off-by: hackerchai --- Cargo.toml | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1fefcbbe..5590bd4e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "Apache-2.0" name = "casbin" readme = "README.md" repository = "https://github.com/casbin/casbin-rs" -version = "2.0.7" +version = "2.0.8" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/README.md b/README.md index 465ef786..161e4559 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,8 @@ Add this package to `Cargo.toml` of your project. (Check https://crates.io/crate ```toml [dependencies] -casbin = { version = "2.0.7", default-features = false, features = ["runtime-async-std", "logging", "incremental"] } -tokio = { version = "1.4.0", features = ["fs", "io-util"] } +casbin = { version = "2.0.8", default-features = false, features = ["runtime-async-std", "logging", "incremental"] } +tokio = { version = "1.10.0", features = ["fs", "io-util"] } ``` **Warning**: `tokio v1.0` or later is supported from `casbin v2.0.6`, we recommend that you upgrade the relevant components to ensure that they work properly. The last version that supports `tokio v0.2` is `casbin v2.0.5` , you can choose according to your needs. From 30be6fd49930a5b1662c091783ee528e70fa1f5c Mon Sep 17 00:00:00 2001 From: hackerchai Date: Thu, 19 Aug 2021 10:44:09 +0800 Subject: [PATCH 3/3] fix: cargo fmt Signed-off-by: hackerchai --- src/rbac/default_role_manager.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/rbac/default_role_manager.rs b/src/rbac/default_role_manager.rs index 71eecf2f..19b426c3 100644 --- a/src/rbac/default_role_manager.rs +++ b/src/rbac/default_role_manager.rs @@ -287,10 +287,8 @@ impl Role { } fn add_role(&mut self, other_role: Arc>) -> bool { - let not_exists = !self - .roles - .iter() - .any(|role| Arc::ptr_eq(role, &other_role)); + let not_exists = + !self.roles.iter().any(|role| Arc::ptr_eq(role, &other_role)); if not_exists { self.roles.push(other_role);