Skip to content
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

Restrict the dependency on indexmap to v2 only #51

Merged
merged 4 commits into from
Jul 12, 2024
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
8 changes: 0 additions & 8 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ jobs:
rust:
- stable
- 1.64.0
indexmap:
- 1.9.3
- latest
include:
- os: ubuntu-latest
rust: stable
Expand All @@ -44,11 +41,6 @@ jobs:
default: true
override: true

- name: Change indexmap version
if: matrix.indexmap != 'latest'
run: |
cargo update -p indexmap --precise ${{ matrix.indexmap }}

- name: cargo test
uses: actions-rs/cargo@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ derive = ["implicit-clone-derive"]

[dependencies]
implicit-clone-derive = { version = "0.1", optional = true, path = "./implicit-clone-derive" }
indexmap = { version = ">= 1, <= 2", optional = true }
indexmap = { version = "2", optional = true }
serde = { version = "1", optional = true }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion implicit-clone-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ syn = { version = "2", features = ["full"] }

[dev-dependencies]
implicit-clone = { path = ".." }
trybuild = "1"
trybuild = "=1.0.89"
rustversion = "1"
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ mod test {
#[test]
fn custom() {
#[derive(Clone)]
#[allow(dead_code)]
struct ImplicitCloneType;

impl ImplicitClone for ImplicitCloneType {}
Expand Down
20 changes: 10 additions & 10 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'sta
///
/// Computes in **O(1)** time (average).
#[inline]
pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<V>
pub fn get<Q>(&self, key: &Q) -> Option<V>
where
K: Borrow<Q>,
Q: Hash + Eq,
Q: Hash + Eq + ?Sized,
{
match self {
Self::Static(a) => a
Expand All @@ -181,10 +181,10 @@ impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'sta
///
/// Computes in **O(1)** time (average).
#[inline]
pub fn get_key_value<Q: ?Sized>(&self, key: &Q) -> Option<(K, V)>
pub fn get_key_value<Q>(&self, key: &Q) -> Option<(K, V)>
where
K: Borrow<Q>,
Q: Hash + Eq,
Q: Hash + Eq + ?Sized,
{
match self {
Self::Static(a) => a.iter().find(|(k, _)| k.borrow() == key).cloned(),
Expand All @@ -194,10 +194,10 @@ impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'sta

/// Return item index, key and value
#[inline]
pub fn get_full<Q: ?Sized>(&self, key: &Q) -> Option<(usize, K, V)>
pub fn get_full<Q>(&self, key: &Q) -> Option<(usize, K, V)>
where
K: Borrow<Q>,
Q: Hash + Eq,
Q: Hash + Eq + ?Sized,
{
match self {
Self::Static(a) => a
Expand Down Expand Up @@ -225,10 +225,10 @@ impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'sta
///
/// Computes in **O(1)** time (average).
#[inline]
pub fn get_index_of<Q: ?Sized>(&self, key: &Q) -> Option<usize>
pub fn get_index_of<Q>(&self, key: &Q) -> Option<usize>
where
K: Borrow<Q>,
Q: Hash + Eq,
Q: Hash + Eq + ?Sized,
{
match self {
Self::Static(a) => a
Expand All @@ -243,10 +243,10 @@ impl<K: Eq + Hash + ImplicitClone + 'static, V: PartialEq + ImplicitClone + 'sta
///
/// Computes in **O(1)** time (average).
#[inline]
pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
where
K: Borrow<Q>,
Q: Hash + Eq,
Q: Hash + Eq + ?Sized,
{
match self {
Self::Static(a) => a.iter().any(|(k, _)| k.borrow() == key),
Expand Down
Loading