Skip to content

Commit 910a00e

Browse files
committed
Use Result<_, io::Error> over io::Result<_>
Personally I've always found the overload of a prelude enum to be confusing, and never bothered to handle it properly in bindings as a result. To avoid needing to do so now, we simply move the newly-introduced `io::Result` usages over to `Result<_, io::Error>`.
1 parent 7b4fb9d commit 910a00e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lightning/src/util/persist.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use bitcoin::{BlockHash, Txid};
1616

1717
use crate::{io, log_error};
1818
use crate::alloc::string::ToString;
19-
use crate::prelude::{Vec, String};
19+
use crate::prelude::*;
2020

2121
use crate::chain;
2222
use crate::chain::chaininterface::{BroadcasterInterface, FeeEstimator};
@@ -98,11 +98,11 @@ pub trait KVStore {
9898
/// `namespace` and `sub_namespace`.
9999
///
100100
/// [`ErrorKind::NotFound`]: io::ErrorKind::NotFound
101-
fn read(&self, namespace: &str, sub_namespace: &str, key: &str) -> io::Result<Vec<u8>>;
101+
fn read(&self, namespace: &str, sub_namespace: &str, key: &str) -> Result<Vec<u8>, io::Error>;
102102
/// Persists the given data under the given `key`.
103103
///
104104
/// Will create the given `namespace` and `sub_namespace` if not already present in the store.
105-
fn write(&self, namespace: &str, sub_namespace: &str, key: &str, buf: &[u8]) -> io::Result<()>;
105+
fn write(&self, namespace: &str, sub_namespace: &str, key: &str, buf: &[u8]) -> Result<(), io::Error>;
106106
/// Removes any data that had previously been persisted under the given `key`.
107107
///
108108
/// If the `lazy` flag is set to `true`, the backend implementation might choose to lazily
@@ -117,12 +117,12 @@ pub trait KVStore {
117117
///
118118
/// Returns successfully if no data will be stored for the given `namespace`, `sub_namespace`, and
119119
/// `key`, independently of whether it was present before its invokation or not.
120-
fn remove(&self, namespace: &str, sub_namespace: &str, key: &str, lazy: bool) -> io::Result<()>;
120+
fn remove(&self, namespace: &str, sub_namespace: &str, key: &str, lazy: bool) -> Result<(), io::Error>;
121121
/// Returns a list of keys that are stored under the given `sub_namespace` in `namespace`.
122122
///
123123
/// Returns the keys in arbitrary order, so users requiring a particular order need to sort the
124124
/// returned keys. Returns an empty list if `namespace` or `sub_namespace` is unknown.
125-
fn list(&self, namespace: &str, sub_namespace: &str) -> io::Result<Vec<String>>;
125+
fn list(&self, namespace: &str, sub_namespace: &str) -> Result<Vec<String>, io::Error>;
126126
}
127127

128128
/// Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk.

0 commit comments

Comments
 (0)