-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add patches for directories/directories-next/option-ext
The rational is detailed in the root Cargo.toml. While I don't personally mind MPL dependencies, even if I don't prefer them (they're allowed in the deny.toml for a reason), I do mind the pointless scope creep and wish to highlight how little it actually used from the crate by re-defining it as the single function. We could also fork directories-next, or directories, and remove the usage of option-ext per dirs-dev/dirs-sys-rs#24, yet that'd be a much larger task than what was done here. In the future, it may be beneficial to submit a PR to wasmtime replacing directories-next with home, a cargo-team maintained library to get the home directory and associated folders. An example migration can be found at harryfei/which-rs#80.
- Loading branch information
1 parent
c7b0939
commit b2f72cf
Showing
5 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "directories-next" | ||
version = "2.0.0" | ||
description = "Patch from directories-next back to directories" | ||
license = "MIT" | ||
repository = "https://github.com/serai-dex/serai/tree/develop/substrate/tree-cleanup/directories-next" | ||
authors = ["Luke Parker <[email protected]>"] | ||
keywords = [] | ||
edition = "2021" | ||
rust-version = "1.74" | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
rustdoc-args = ["--cfg", "docsrs"] | ||
|
||
[dependencies] | ||
directories = "5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub use directories::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "option-ext" | ||
version = "0.2.0" | ||
description = "Non-MPL option-ext with the exactly needed API for directories" | ||
license = "MIT" | ||
repository = "https://github.com/serai-dex/serai/tree/develop/substrate/tree-cleanup/option-ext" | ||
authors = ["Luke Parker <[email protected]>"] | ||
keywords = [] | ||
edition = "2021" | ||
rust-version = "1.74" | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
rustdoc-args = ["--cfg", "docsrs"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pub trait OptionExt<T: PartialEq> { | ||
fn contains(&self, x: &T) -> bool; | ||
} | ||
impl<T: PartialEq> OptionExt<T> for Option<T> { | ||
fn contains(&self, x: &T) -> bool { | ||
self.as_ref() == Some(x) | ||
} | ||
} |