Skip to content

Commit 027e1c7

Browse files
committed
Remove no-std-net
1 parent fc0778f commit 027e1c7

File tree

7 files changed

+13
-62
lines changed

7 files changed

+13
-62
lines changed

idna/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ doctest = false
1717
default = ["std"]
1818
std = ["alloc", "unicode-bidi/std", "unicode-normalization/std"]
1919
alloc = []
20-
# Enable nightly features
21-
unstable = []
2220

2321
[[test]]
2422
name = "tests"

idna/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
//! > that minimizes the impact of this transition for client software,
3333
//! > allowing client software to access domains that are valid under either system.
3434
#![no_std]
35-
#[cfg_attr(feature = "unstable", feature("error_in_core"))]
3635
// For forwards compatibility
3736
#[cfg(feature = "std")]
3837
extern crate std;

idna/src/uts46.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ impl From<Errors> for Result<(), Errors> {
714714
#[cfg(feature = "std")]
715715
impl std::error::Error for Errors {}
716716

717-
#[cfg(feature = "unstable")]
717+
#[cfg(not(feature = "std"))]
718718
impl core::error::Error for Errors {}
719719

720720
impl fmt::Display for Errors {

url/Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ form_urlencoded = { version = "1.2.1", path = "../form_urlencoded", default-feat
2929
idna = { version = "0.5.0", path = "../idna", default-features = false, features = ["alloc"] }
3030
percent-encoding = { version = "2.3.1", path = "../percent_encoding", default-features = false, features = ["alloc"] }
3131
serde = {version = "1.0", optional = true, features = ["derive"]}
32-
no-std-net = { version = "0.6.0", default-features = false, optional = true }
3332

3433
[features]
3534
default = ["std"]
@@ -40,11 +39,6 @@ alloc = ["form_urlencoded/alloc", "idna/alloc", "percent-encoding/alloc"]
4039
debugger_visualizer = []
4140
# Expose internal offsets of the URL.
4241
expose_internals = []
43-
# For no_std: Allow the use of no_std_net instead of nightly
44-
no_std_net = ["no-std-net"]
45-
# UNSTABLE FEATURES (requires Rust nightly)
46-
# For no_std: Use errors_in_core and net_in_core
47-
unstable = ["idna/unstable"]
4842

4943
[[test]]
5044
name = "url_wpt"

url/src/lib.rs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -185,21 +185,16 @@ use alloc::str;
185185
use alloc::string::{String, ToString};
186186
use alloc::borrow::ToOwned;
187187
#[cfg(feature = "std")]
188-
use std::path::PathBuf;
188+
use std::path::{Path, PathBuf};
189189
use core::convert::TryFrom;
190190

191191
/// `std` version of `net`
192192
#[cfg(feature = "std")]
193193
pub(crate) mod net {
194194
pub use std::net::*;
195195
}
196-
/// `no_std` non-nightly of `net`
197-
#[cfg(all(not(feature = "std"), feature = "no_std_net"))]
198-
pub(crate) mod net {
199-
pub use no_std_net::*;
200-
}
201196
/// `no_std` nightly version of `net`
202-
#[cfg(all(not(feature = "std"), not(feature = "no_std_net")))]
197+
#[cfg(not(feature = "std"))]
203198
pub(crate) mod net {
204199
pub use core::net::*;
205200
}
@@ -2717,7 +2712,7 @@ impl Url {
27172712
any(unix, windows, target_os = "redox", target_os = "wasi")
27182713
))]
27192714
#[allow(clippy::result_unit_err)]
2720-
pub fn to_file_path(&self) -> Result<std::path::PathBuf, ()> {
2715+
pub fn to_file_path(&self) -> Result<PathBuf, ()> {
27212716
if let Some(segments) = self.path_segments() {
27222717
let host = match self.host() {
27232718
None | Some(Host::Domain("localhost")) => None,
@@ -2921,7 +2916,7 @@ impl<'de> serde::Deserialize<'de> for Url {
29212916

29222917
#[cfg(all(feature = "std", any(unix, target_os = "redox", target_os = "wasi")))]
29232918
fn path_to_file_url_segments(
2924-
path: &std::path::Path,
2919+
path: &Path,
29252920
serialization: &mut String,
29262921
) -> Result<(u32, HostInternal), ()> {
29272922
use parser::SPECIAL_PATH_SEGMENT;
@@ -2953,7 +2948,7 @@ fn path_to_file_url_segments(
29532948

29542949
#[cfg(all(feature = "std", windows))]
29552950
fn path_to_file_url_segments(
2956-
path: &std::path::Path,
2951+
path: &Path,
29572952
serialization: &mut String,
29582953
) -> Result<(u32, HostInternal), ()> {
29592954
path_to_file_url_segments_windows(path, serialization)
@@ -2964,7 +2959,7 @@ fn path_to_file_url_segments(
29642959
#[cfg_attr(not(windows), allow(dead_code))]
29652960
#[cfg(feature = "std")]
29662961
fn path_to_file_url_segments_windows(
2967-
path: &std::path::Path,
2962+
path: &Path,
29682963
serialization: &mut String,
29692964
) -> Result<(u32, HostInternal), ()> {
29702965
use crate::parser::PATH_SEGMENT;
@@ -3079,14 +3074,13 @@ fn file_url_segments_to_pathbuf(
30793074
fn file_url_segments_to_pathbuf(
30803075
host: Option<&str>,
30813076
segments: str::Split<char>,
3082-
) -> Result<std::path::PathBuf, ()> {
3077+
) -> Result<PathBuf, ()> {
30833078
file_url_segments_to_pathbuf_windows(host, segments)
30843079
}
30853080

3086-
#[cfg(feature = "std")]
30873081
// Build this unconditionally to alleviate https://github.com/servo/rust-url/issues/102
3088-
#[cfg_attr(not(windows), allow(dead_code))]
30893082
#[cfg(feature = "std")]
3083+
#[cfg_attr(not(windows), allow(dead_code))]
30903084
fn file_url_segments_to_pathbuf_windows(
30913085
host: Option<&str>,
30923086
mut segments: str::Split<'_, char>,
@@ -3131,7 +3125,7 @@ fn file_url_segments_to_pathbuf_windows(
31313125
Err(..) => return Err(()),
31323126
}
31333127
}
3134-
let path = std::path::PathBuf::from(string);
3128+
let path = PathBuf::from(string);
31353129
debug_assert!(
31363130
path.is_absolute(),
31373131
"to_file_path() failed to produce an absolute Path"

url/src/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ macro_rules! simple_enum_error {
7676
#[cfg(feature = "std")]
7777
impl std::error::Error for ParseError {}
7878

79-
#[cfg(feature = "unstable")]
79+
#[cfg(not(feature = "std"))]
8080
impl core::error::Error for ParseError {}
8181

8282
simple_enum_error! {

url/tests/unit.rs

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,6 @@
88

99
//! Unit tests
1010
#![no_std]
11-
#![cfg_attr(
12-
all(
13-
not(feature = "std"),
14-
not(feature = "no_std_net"),
15-
feature = "unstable"
16-
),
17-
feature(ip_in_core)
18-
)]
19-
#![cfg_attr(
20-
all(not(feature = "std"), feature = "unstable"),
21-
feature(error_in_core)
22-
)]
2311

2412
#[cfg(feature = "std")]
2513
extern crate std;
@@ -30,44 +18,22 @@ extern crate alloc;
3018
#[cfg(not(feature = "alloc"))]
3119
compile_error!("the `alloc` feature must be enabled");
3220

33-
#[cfg(feature = "std")]
34-
extern crate std;
35-
36-
#[macro_use]
37-
extern crate alloc;
38-
39-
#[cfg(not(feature = "alloc"))]
40-
compile_error!("the `alloc` feature must be enabled");
41-
42-
#[cfg(not(any(feature = "no_std_net", feature = "std", feature = "unstable")))]
43-
compile_error!(
44-
"Either the `no_std_net`, `std` or, on nightly, the `unstable` feature, must be enabled"
45-
);
46-
4721
use alloc::borrow::Cow;
4822
use alloc::borrow::ToOwned;
4923
use alloc::string::{String, ToString};
5024
use alloc::vec::Vec;
5125
use core::cell::{Cell, RefCell};
5226
#[cfg(feature = "std")]
53-
use std::{
54-
dbg,
55-
path::{Path, PathBuf},
56-
};
27+
use std::dbg;
5728
use url::{form_urlencoded, Host, Origin, Url};
5829

5930
/// `std` version of `net`
6031
#[cfg(feature = "std")]
6132
pub(crate) mod net {
6233
pub use std::net::*;
6334
}
64-
/// `no_std` non-nightly of `net`
65-
#[cfg(all(not(feature = "std"), feature = "no_std_net"))]
66-
pub(crate) mod net {
67-
pub use no_std_net::*;
68-
}
6935
/// `no_std` nightly version of `net`
70-
#[cfg(all(not(feature = "std"), not(feature = "no_std_net")))]
36+
#[cfg(not(feature = "std"))]
7137
pub(crate) mod net {
7238
pub use core::net::*;
7339
}

0 commit comments

Comments
 (0)