Skip to content

Commit 9a88795

Browse files
committed
fix: tidy up features
The `russh` feature shouldn't require `async-std`, but that feature was gating the whole async subsystem, so this moves things around a little.
1 parent 4a150d7 commit 9a88795

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

gix-transport/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ async-client = [
6565
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
6666
serde = ["dep:serde"]
6767

68-
russh = ["dep:russh", "dep:tokio", "async-client", "async-std"]
68+
russh = ["dep:russh", "dep:tokio", "async-client"]
6969

7070
[[test]]
7171
name = "blocking-transport"

gix-transport/src/client/async_io/connect.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
pub use crate::client::non_io_types::connect::{Error, Options};
22

3-
#[cfg(feature = "async-std")]
43
pub(crate) mod function {
5-
use crate::client::{git, non_io_types::connect::Error};
4+
use crate::client::non_io_types::connect::Error;
65

76
/// A general purpose connector connecting to a repository identified by the given `url`.
87
///
98
/// This includes connections to
10-
/// [git daemons][crate::client::git::connect()] only at the moment.
9+
/// [git daemons][crate::client::git::connect()] and `ssh`,
1110
///
1211
/// Use `options` to further control specifics of the transport resulting from the connection.
1312
pub async fn connect<Url, E>(
@@ -18,28 +17,30 @@ pub(crate) mod function {
1817
Url: TryInto<gix_url::Url, Error = E>,
1918
gix_url::parse::Error: From<E>,
2019
{
21-
let mut url = url.try_into().map_err(gix_url::parse::Error::from)?;
20+
let url = url.try_into().map_err(gix_url::parse::Error::from)?;
2221
Ok(match url.scheme {
22+
#[cfg(feature = "async-std")]
2323
gix_url::Scheme::Git => {
2424
if url.user().is_some() {
2525
return Err(Error::UnsupportedUrlTokens {
2626
url: url.to_bstring(),
2727
scheme: url.scheme,
2828
});
2929
}
30-
let path = std::mem::take(&mut url.path);
30+
3131
Box::new(
32-
git::Connection::new_tcp(
32+
crate::client::git::Connection::new_tcp(
3333
url.host().expect("host is present in url"),
3434
url.port,
35-
path,
35+
url.path.clone(),
3636
options.version,
3737
options.trace,
3838
)
3939
.await
4040
.map_err(|e| Box::new(e) as Box<dyn std::error::Error + Send + Sync>)?,
4141
)
4242
}
43+
#[cfg(feature = "russh")]
4344
gix_url::Scheme::Ssh => {
4445
Box::new(crate::client::async_io::ssh::connect(url, options.version, options.trace).await?)
4546
}

gix-transport/src/client/async_io/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ pub use traits::{SetServiceResponse, Transport, TransportV2Ext};
99

1010
///
1111
pub mod connect;
12-
#[cfg(feature = "async-std")]
1312
pub use connect::function::connect;
1413

1514
#[cfg(feature = "russh")]

gix-transport/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub use traits::IsSpuriousError;
8585
pub mod client;
8686

8787
#[doc(inline)]
88-
#[cfg(any(feature = "blocking-client", all(feature = "async-client", feature = "async-std")))]
88+
#[cfg(any(feature = "blocking-client", feature = "async-client"))]
8989
pub use client::connect;
9090

9191
#[cfg(all(feature = "async-client", feature = "blocking-client"))]

0 commit comments

Comments
 (0)