Skip to content

Commit c1c9d08

Browse files
authored
Deprecate Watcher::remove in favor of Drop (#76)
1 parent 03c8506 commit c1c9d08

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/client/watcher.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ impl OneshotWatcher {
6868
}
6969

7070
/// Removes this watcher.
71+
#[deprecated(since = "0.10.0", note = "Rust has Drop")]
7172
pub async fn remove(self) -> Result<(), Error> {
7273
self.receiver.remove().await
7374
}
@@ -110,6 +111,7 @@ impl PersistentWatcher {
110111
/// removing individually.
111112
///
112113
/// [ZOOKEEPER-4472]: https://issues.apache.org/jira/browse/ZOOKEEPER-4472
114+
#[deprecated(since = "0.10.0", note = "Rust has Drop")]
113115
pub async fn remove(self) -> Result<(), Error> {
114116
self.receiver.remove().await
115117
}

tests/zookeeper.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,7 @@ async fn test_delete() {
13391339

13401340
#[asyncs::test]
13411341
#[test_log::test]
1342+
#[allow(deprecated)]
13421343
async fn test_oneshot_watcher() {
13431344
let cluster = Cluster::new().await;
13441345
let client = cluster.client(None).await;
@@ -1611,6 +1612,7 @@ async fn test_fail_watch_with_concurrent_passive_remove() {
16111612

16121613
#[asyncs::test]
16131614
#[test_log::test]
1615+
#[allow(deprecated)]
16141616
async fn test_persistent_watcher() {
16151617
let cluster = Cluster::new().await;
16161618
let client = cluster.client(None).await;
@@ -1791,6 +1793,7 @@ async fn test_watcher_coexist_on_same_path() {
17911793

17921794
#[asyncs::test]
17931795
#[test_log::test]
1796+
#[allow(deprecated)]
17941797
async fn test_watcher_remove_after_client_closed() {
17951798
let cluster = Cluster::new().await;
17961799
let client = cluster.client(None).await;
@@ -1811,6 +1814,7 @@ async fn test_watcher_remove_after_client_closed() {
18111814

18121815
#[asyncs::test]
18131816
#[test_log::test]
1817+
#[allow(deprecated)]
18141818
async fn test_watcher_remove_session_expired() {
18151819
let cluster = Cluster::new().await;
18161820
let client = cluster.client(None).await;
@@ -1841,6 +1845,7 @@ async fn test_watcher_remove_session_expired() {
18411845
// Use a single thread executor to predict request process order.
18421846
#[asyncs::test(parallelism = 1)]
18431847
#[test_log::test]
1848+
#[allow(deprecated)]
18441849
async fn test_watcher_remove_no_watcher() {
18451850
let cluster = Cluster::new().await;
18461851
let client = cluster.client(None).await;

0 commit comments

Comments
 (0)