@@ -20,22 +20,13 @@ use core::str;
20
20
///
21
21
/// ```rust
22
22
/// use url::Url;
23
- /// # use url::ParseError;
24
- /// # #[derive(Debug)]
25
- /// # /// A simple wrapper error struct for `no_std` support
26
- /// # struct TestError;
27
- /// # impl From<ParseError> for TestError {
28
- /// # fn from(value: ParseError) -> Self {
29
- /// # TestError {}
30
- /// # }
31
- /// # }
32
- /// # impl From<&str> for TestError {
33
- /// # fn from(value: &str) -> Self {
34
- /// # TestError {}
35
- /// # }
36
- /// # }
37
23
///
38
- /// # fn run() -> Result<(), TestError> {
24
+ /// # #[cfg(feature = "std")]
25
+ /// # use std::error::Error;
26
+ /// # #[cfg(not(feature = "std"))]
27
+ /// # use core::error::Error;
28
+ ///
29
+ /// # fn run() -> Result<(), Box<dyn Error>> {
39
30
/// let mut url = Url::parse("mailto:me@example.com")?;
40
31
/// assert!(url.path_segments_mut().is_err());
41
32
///
@@ -92,22 +83,13 @@ impl<'a> PathSegmentsMut<'a> {
92
83
///
93
84
/// ```rust
94
85
/// use url::Url;
95
- /// # use url::ParseError;
96
- /// # #[derive(Debug)]
97
- /// # /// A simple wrapper error struct for `no_std` support
98
- /// # struct TestError;
99
- /// # impl From<ParseError> for TestError {
100
- /// # fn from(value: ParseError) -> Self {
101
- /// # TestError {}
102
- /// # }
103
- /// # }
104
- /// # impl From<&str> for TestError {
105
- /// # fn from(value: &str) -> Self {
106
- /// # TestError {}
107
- /// # }
108
- /// # }
109
86
///
110
- /// # fn run() -> Result<(), TestError> {
87
+ /// # #[cfg(feature = "std")]
88
+ /// # use std::error::Error;
89
+ /// # #[cfg(not(feature = "std"))]
90
+ /// # use core::error::Error;
91
+ ///
92
+ /// # fn run() -> Result<(), Box<dyn Error>> {
111
93
/// let mut url = Url::parse("https://github.com/servo/rust-url/")?;
112
94
/// url.path_segments_mut().map_err(|_| "cannot be base")?
113
95
/// .clear().push("logout");
@@ -133,22 +115,13 @@ impl<'a> PathSegmentsMut<'a> {
133
115
///
134
116
/// ```rust
135
117
/// use url::Url;
136
- /// # use url::ParseError;
137
- /// # #[derive(Debug)]
138
- /// # /// A simple wrapper error struct for `no_std` support
139
- /// # struct TestError;
140
- /// # impl From<ParseError> for TestError {
141
- /// # fn from(value: ParseError) -> Self {
142
- /// # TestError {}
143
- /// # }
144
- /// # }
145
- /// # impl From<&str> for TestError {
146
- /// # fn from(value: &str) -> Self {
147
- /// # TestError {}
148
- /// # }
149
- /// # }
150
118
///
151
- /// # fn run() -> Result<(), TestError> {
119
+ /// # #[cfg(feature = "std")]
120
+ /// # use std::error::Error;
121
+ /// # #[cfg(not(feature = "std"))]
122
+ /// # use core::error::Error;
123
+ ///
124
+ /// # fn run() -> Result<(), Box<dyn Error>> {
152
125
/// let mut url = Url::parse("https://github.com/servo/rust-url/")?;
153
126
/// url.path_segments_mut().map_err(|_| "cannot be base")?
154
127
/// .push("pulls");
@@ -221,22 +194,13 @@ impl<'a> PathSegmentsMut<'a> {
221
194
///
222
195
/// ```rust
223
196
/// use url::Url;
224
- /// # use url::ParseError;
225
- /// # #[derive(Debug)]
226
- /// # /// A simple wrapper error struct for `no_std` support
227
- /// # struct TestError;
228
- /// # impl From<ParseError> for TestError {
229
- /// # fn from(value: ParseError) -> Self {
230
- /// # TestError {}
231
- /// # }
232
- /// # }
233
- /// # impl From<&str> for TestError {
234
- /// # fn from(value: &str) -> Self {
235
- /// # TestError {}
236
- /// # }
237
- /// # }
238
197
///
239
- /// # fn run() -> Result<(), TestError> {
198
+ /// # #[cfg(feature = "std")]
199
+ /// # use std::error::Error;
200
+ /// # #[cfg(not(feature = "std"))]
201
+ /// # use core::error::Error;
202
+ ///
203
+ /// # fn run() -> Result<(), Box<dyn Error>> {
240
204
/// let mut url = Url::parse("https://github.com/")?;
241
205
/// let org = "servo";
242
206
/// let repo = "rust-url";
@@ -254,22 +218,13 @@ impl<'a> PathSegmentsMut<'a> {
254
218
///
255
219
/// ```rust
256
220
/// use url::Url;
257
- /// # use url::ParseError;
258
- /// # #[derive(Debug)]
259
- /// # /// A simple wrapper error struct for `no_std` support
260
- /// # struct TestError;
261
- /// # impl From<ParseError> for TestError {
262
- /// # fn from(value: ParseError) -> Self {
263
- /// # TestError {}
264
- /// # }
265
- /// # }
266
- /// # impl From<&str> for TestError {
267
- /// # fn from(value: &str) -> Self {
268
- /// # TestError {}
269
- /// # }
270
- /// # }
271
221
///
272
- /// # fn run() -> Result<(), TestError> {
222
+ /// # #[cfg(feature = "std")]
223
+ /// # use std::error::Error;
224
+ /// # #[cfg(not(feature = "std"))]
225
+ /// # use core::error::Error;
226
+ ///
227
+ /// # fn run() -> Result<(), Box<dyn Error>> {
273
228
/// let mut url = Url::parse("https://github.com/servo")?;
274
229
/// url.path_segments_mut().map_err(|_| "cannot be base")?
275
230
/// .extend(&["..", "rust-url", ".", "pulls"]);
0 commit comments