Skip to content

Commit 74c0910

Browse files
committed
apply cargo fmt
1 parent 43c7d41 commit 74c0910

File tree

5 files changed

+28
-16
lines changed

5 files changed

+28
-16
lines changed

url/src/host.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
88

9-
use core::cmp;
10-
use core::fmt::{self, Formatter};
11-
use std_core_compat::net::{Ipv4Addr, Ipv6Addr};
129
use alloc::borrow::ToOwned;
1310
use alloc::string::String;
1411
use alloc::string::ToString;
1512
use alloc::vec::Vec;
13+
use core::cmp;
14+
use core::fmt::{self, Formatter};
15+
use std_core_compat::net::{Ipv4Addr, Ipv6Addr};
1616

1717
use percent_encoding::{percent_decode, utf8_percent_encode, CONTROLS};
1818
#[cfg(feature = "serde")]

url/src/lib.rs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ use crate::host::HostInternal;
164164
use crate::parser::{
165165
to_u32, Context, Parser, SchemeType, PATH_SEGMENT, SPECIAL_PATH_SEGMENT, USERINFO,
166166
};
167-
use percent_encoding::{percent_decode, percent_encode, utf8_percent_encode};
168167
use core::borrow::Borrow;
169168
use core::cmp;
170169
use core::fmt::{self, Write};
171170
use core::hash;
172171
use core::mem;
173-
use std_core_compat::net::IpAddr;
174172
use core::ops::{Range, RangeFrom, RangeTo};
175173
use core::str;
174+
use percent_encoding::{percent_decode, percent_encode, utf8_percent_encode};
175+
use std_core_compat::net::IpAddr;
176176

177177
use alloc::borrow::ToOwned;
178178
use alloc::format;
@@ -1291,13 +1291,16 @@ impl Url {
12911291
/// })
12921292
/// }
12931293
/// ```
1294-
#[cfg(all(feature = "std", any(unix, windows, target_os = "redox", target_os = "wasi")))]
1294+
#[cfg(all(
1295+
feature = "std",
1296+
any(unix, windows, target_os = "redox", target_os = "wasi")
1297+
))]
12951298
pub fn socket_addrs(
12961299
&self,
12971300
default_port_number: impl Fn() -> Option<u16>,
12981301
) -> std::io::Result<Vec<std::net::SocketAddr>> {
1299-
use std::net::ToSocketAddrs;
13001302
use std::io;
1303+
use std::net::ToSocketAddrs;
13011304
// Note: trying to avoid the Vec allocation by returning `impl AsRef<[SocketAddr]>`
13021305
// causes borrowck issues because the return value borrows `default_port_number`:
13031306
//
@@ -2483,7 +2486,10 @@ impl Url {
24832486
/// # run().unwrap();
24842487
/// # }
24852488
/// ```
2486-
#[cfg(all(feature = "std", any(unix, windows, target_os = "redox", target_os = "wasi")))]
2489+
#[cfg(all(
2490+
feature = "std",
2491+
any(unix, windows, target_os = "redox", target_os = "wasi")
2492+
))]
24872493
#[allow(clippy::result_unit_err)]
24882494
pub fn from_file_path<P: AsRef<std::path::Path>>(path: P) -> Result<Url, ()> {
24892495
let mut serialization = "file://".to_owned();
@@ -2520,7 +2526,10 @@ impl Url {
25202526
///
25212527
/// Note that `std::path` does not consider trailing slashes significant
25222528
/// and usually does not include them (e.g. in `Path::parent()`).
2523-
#[cfg(all(feature = "std", any(unix, windows, target_os = "redox", target_os = "wasi")))]
2529+
#[cfg(all(
2530+
feature = "std",
2531+
any(unix, windows, target_os = "redox", target_os = "wasi")
2532+
))]
25242533
#[allow(clippy::result_unit_err)]
25252534
pub fn from_directory_path<P: AsRef<std::path::Path>>(path: P) -> Result<Url, ()> {
25262535
let mut url = Url::from_file_path(path)?;
@@ -2637,7 +2646,10 @@ impl Url {
26372646
/// (That is, if the percent-decoded path contains a NUL byte or,
26382647
/// for a Windows path, is not UTF-8.)
26392648
#[inline]
2640-
#[cfg(all(feature = "std", any(unix, windows, target_os = "redox", target_os = "wasi")))]
2649+
#[cfg(all(
2650+
feature = "std",
2651+
any(unix, windows, target_os = "redox", target_os = "wasi")
2652+
))]
26412653
#[allow(clippy::result_unit_err)]
26422654
pub fn to_file_path(&self) -> Result<std::path::PathBuf, ()> {
26432655
if let Some(segments) = self.path_segments() {
@@ -2950,11 +2962,11 @@ fn file_url_segments_to_pathbuf(
29502962
segments: str::Split<'_, char>,
29512963
) -> Result<std::path::PathBuf, ()> {
29522964
use std::ffi::OsStr;
2953-
use std::path::PathBuf;
29542965
#[cfg(any(unix, target_os = "redox"))]
29552966
use std::os::unix::prelude::OsStrExt;
29562967
#[cfg(target_os = "wasi")]
29572968
use std::os::wasi::prelude::OsStrExt;
2969+
use std::path::PathBuf;
29582970

29592971
if host.is_some() {
29602972
return Err(());

url/src/origin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
use crate::host::Host;
1010
use crate::parser::default_port;
1111
use crate::Url;
12-
use core::sync::atomic::{AtomicUsize, Ordering};
1312
use alloc::borrow::ToOwned;
1413
use alloc::format;
1514
use alloc::string::String;
15+
use core::sync::atomic::{AtomicUsize, Ordering};
1616

1717
pub fn url_origin(url: &Url) -> Origin {
1818
let scheme = url.scheme();

url/src/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
88

9-
use std_core_compat::error::Error;
10-
use core::fmt::{self, Formatter, Write};
11-
use core::str;
129
use alloc::string::String;
1310
use alloc::string::ToString;
11+
use core::fmt::{self, Formatter, Write};
12+
use core::str;
13+
use std_core_compat::error::Error;
1414

1515
use crate::host::{Host, HostInternal};
1616
use crate::Url;

url/src/path_segments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
use crate::parser::{self, to_u32, SchemeType};
1010
use crate::Url;
11-
use core::str;
1211
use alloc::string::String;
12+
use core::str;
1313

1414
/// Exposes methods to manipulate the path of an URL that is not cannot-be-base.
1515
///

0 commit comments

Comments
 (0)