Skip to content

Commit 1290819

Browse files
committed
Merge #88: timeout() and socks() don't return Result
561db26 `timeout()` and `socks()` don't return Result (Riccardo Casatta) Pull request description: The `Result` was necessary in the past because they couldn't both be set, this is not true anymore after 7493630 ACKs for top commit: afilini: ACK 561db26 Tree-SHA512: 7654cfbbc7beac6acec786060e373bbc046e1dae0faf2b2ca1df33121e9e92a8f4950c7f8775e44226a62483aeae41c76162cf037ce38137c44d2fedd38560c8
2 parents add1b78 + 561db26 commit 1290819

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

examples/tor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn main() {
66
// NOTE: This assumes Tor is running localy, with an unauthenticated Socks5 listening at
77
// localhost:9050
88
let proxy = Socks5Config::new("127.0.0.1:9050");
9-
let config = ConfigBuilder::new().socks5(Some(proxy)).unwrap().build();
9+
let config = ConfigBuilder::new().socks5(Some(proxy)).build();
1010

1111
let client = Client::from_config("tcp://explorernuoc63nb.onion:110", config.clone()).unwrap();
1212
let res = client.server_features();

src/client.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,7 @@ mod tests {
404404
let now = Instant::now();
405405
let client = Client::from_config(
406406
&endpoint,
407-
crate::config::ConfigBuilder::new()
408-
.timeout(Some(5))
409-
.unwrap()
410-
.build(),
407+
crate::config::ConfigBuilder::new().timeout(Some(5)).build(),
411408
);
412409
let elapsed = now.elapsed();
413410

src/config.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ impl ConfigBuilder {
4444

4545
/// Set the socks5 config if Some, it accept an `Option` because it's easier for the caller to use
4646
/// in a method chain
47-
pub fn socks5(mut self, socks5_config: Option<Socks5Config>) -> Result<Self, Error> {
47+
pub fn socks5(mut self, socks5_config: Option<Socks5Config>) -> Self {
4848
self.config.socks5 = socks5_config;
49-
Ok(self)
49+
self
5050
}
5151

5252
/// Sets the timeout
53-
pub fn timeout(mut self, timeout: Option<u8>) -> Result<Self, Error> {
53+
pub fn timeout(mut self, timeout: Option<u8>) -> Self {
5454
self.config.timeout = timeout.map(|t| Duration::from_secs(t as u64));
55-
Ok(self)
55+
self
5656
}
5757

5858
/// Sets the retry attempts number

0 commit comments

Comments
 (0)