From ef421e20eb71b062f2cb1856037d0e3ded3793b9 Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Sun, 1 May 2022 11:50:37 +0200 Subject: [PATCH 1/3] Deal with IntoIter deprecation --- src/graph.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/graph.rs b/src/graph.rs index 1068bcb..8ce3832 100644 --- a/src/graph.rs +++ b/src/graph.rs @@ -1,4 +1,3 @@ -use std::array::IntoIter; use std::cell::Cell; use std::collections::HashMap; use std::collections::HashSet; @@ -116,7 +115,7 @@ where if lb < ub { // This edge might introduce a cycle, need to recompute the topological sort - let mut visited = IntoIter::new([x, y]).collect(); + let mut visited = IntoIterator::into_iter([x, y]).collect(); let mut delta_f = Vec::new(); let mut delta_b = Vec::new(); From 3b9b90846081c4652e76fb1d746760d14fc24be6 Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Sun, 1 May 2022 11:50:50 +0200 Subject: [PATCH 2/3] Correctly mark mutex reference as unused --- src/stdsync.rs | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/stdsync.rs b/src/stdsync.rs index 14a575b..462e697 100644 --- a/src/stdsync.rs +++ b/src/stdsync.rs @@ -97,7 +97,7 @@ pub struct TracingMutex { #[derive(Debug)] pub struct TracingMutexGuard<'a, T> { inner: MutexGuard<'a, T>, - mutex: BorrowedMutex<'a>, + _mutex: BorrowedMutex<'a>, } fn map_lockresult(result: LockResult, mapper: F) -> LockResult @@ -144,7 +144,7 @@ impl TracingMutex { let result = self.inner.lock(); let mapper = |guard| TracingMutexGuard { - mutex, + _mutex: mutex, inner: guard, }; @@ -163,7 +163,7 @@ impl TracingMutex { let result = self.inner.try_lock(); let mapper = |guard| TracingMutexGuard { - mutex, + _mutex: mutex, inner: guard, }; @@ -227,7 +227,7 @@ pub struct TracingRwLock { #[derive(Debug)] pub struct TracingRwLockGuard<'a, L> { inner: L, - mutex: BorrowedMutex<'a>, + _mutex: BorrowedMutex<'a>, } /// Wrapper around [`std::sync::RwLockReadGuard`]. @@ -254,7 +254,10 @@ impl TracingRwLock { let mutex = self.id.get_borrowed(); let result = self.inner.read(); - map_lockresult(result, |inner| TracingRwLockGuard { inner, mutex }) + map_lockresult(result, |inner| TracingRwLockGuard { + inner, + _mutex: mutex, + }) } /// Wrapper for [`std::sync::RwLock::write`]. @@ -268,7 +271,10 @@ impl TracingRwLock { let mutex = self.id.get_borrowed(); let result = self.inner.write(); - map_lockresult(result, |inner| TracingRwLockGuard { inner, mutex }) + map_lockresult(result, |inner| TracingRwLockGuard { + inner, + _mutex: mutex, + }) } /// Wrapper for [`std::sync::RwLock::try_read`]. @@ -282,7 +288,10 @@ impl TracingRwLock { let mutex = self.id.get_borrowed(); let result = self.inner.try_read(); - map_trylockresult(result, |inner| TracingRwLockGuard { inner, mutex }) + map_trylockresult(result, |inner| TracingRwLockGuard { + inner, + _mutex: mutex, + }) } /// Wrapper for [`std::sync::RwLock::try_write`]. @@ -296,7 +305,10 @@ impl TracingRwLock { let mutex = self.id.get_borrowed(); let result = self.inner.try_write(); - map_trylockresult(result, |inner| TracingRwLockGuard { inner, mutex }) + map_trylockresult(result, |inner| TracingRwLockGuard { + inner, + _mutex: mutex, + }) } /// Return a mutable reference to the underlying data. From 38b3b226cc1338278ea743af2af0b00760503228 Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Sun, 1 May 2022 12:00:10 +0200 Subject: [PATCH 3/3] Move to edition 2021 altogether --- CHANGELOG.md | 4 ++++ Cargo.toml | 2 +- src/graph.rs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06233fd..6e3b625 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Simple benchmark to track the rough performance penalty incurred by dependency tracking. +### Changed + +- The project now targets edition 2021 + ## [0.1.2] - 2021-05-27 ### Added diff --git a/Cargo.toml b/Cargo.toml index 47bcb36..e378f48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "tracing-mutex" version = "0.1.2" authors = ["Bert Peters "] -edition = "2018" +edition = "2021" license = "MIT OR Apache-2.0" documentation = "https://docs.rs/tracing-mutex" categories = ["concurrency", "development-tools::debugging"] diff --git a/src/graph.rs b/src/graph.rs index 8ce3832..a98b022 100644 --- a/src/graph.rs +++ b/src/graph.rs @@ -115,7 +115,7 @@ where if lb < ub { // This edge might introduce a cycle, need to recompute the topological sort - let mut visited = IntoIterator::into_iter([x, y]).collect(); + let mut visited = [x, y].into_iter().collect(); let mut delta_f = Vec::new(); let mut delta_b = Vec::new();