|
|
@@ -1434,7 +1434,7 @@ impl Url {
|
|
|
/// Return an object with methods to manipulate this URL’s path segments.
|
|
|
///
|
|
|
/// Return `Err(())` if this URL is cannot-be-a-base.
|
|
|
- #[allow(clippy::result_map_unit_fn)]
|
|
|
+ #[allow(clippy::result_unit_err)]
|
|
|
pub fn path_segments_mut(&mut self) -> Result<PathSegmentsMut<'_>, ()> {
|
|
|
if self.cannot_be_a_base() {
|
|
|
Err(())
|
|
|
@@ -1518,7 +1518,7 @@ impl Url {
|
|
|
/// # }
|
|
|
/// # run().unwrap();
|
|
|
/// ```
|
|
|
- #[allow(clippy::result_map_unit_fn)]
|
|
|
+ #[allow(clippy::result_unit_err)]
|
|
|
pub fn set_port(&mut self, mut port: Option<u16>) -> Result<(), ()> {
|
|
|
// has_host implies !cannot_be_a_base
|
|
|
if !self.has_host() || self.host() == Some(Host::Domain("")) || self.scheme() == "file" {
|
|
|
@@ -1789,7 +1789,7 @@ impl Url {
|
|
|
/// # run().unwrap();
|
|
|
/// ```
|
|
|
///
|
|
|
- #[allow(clippy::result_map_unit_fn)]
|
|
|
+ #[allow(clippy::result_unit_err)]
|
|
|
pub fn set_ip_host(&mut self, address: IpAddr) -> Result<(), ()> {
|
|
|
if self.cannot_be_a_base() {
|
|
|
return Err(());
|
|
|
@@ -1829,7 +1829,7 @@ impl Url {
|
|
|
/// # }
|
|
|
/// # run().unwrap();
|
|
|
/// ```
|
|
|
- #[allow(clippy::result_map_unit_fn)]
|
|
|
+ #[allow(clippy::result_unit_err)]
|
|
|
pub fn set_password(&mut self, password: Option<&str>) -> Result<(), ()> {
|
|
|
// has_host implies !cannot_be_a_base
|
|
|
if !self.has_host() || self.host() == Some(Host::Domain("")) || self.scheme() == "file" {
|
|
|
@@ -1922,7 +1922,7 @@ impl Url {
|
|
|
/// # }
|
|
|
/// # run().unwrap();
|
|
|
/// ```
|
|
|
- #[allow(clippy::result_map_unit_fn)]
|
|
|
+ #[allow(clippy::result_unit_err)]
|
|
|
pub fn set_username(&mut self, username: &str) -> Result<(), ()> {
|
|
|
// has_host implies !cannot_be_a_base
|
|
|
if !self.has_host() || self.host() == Some(Host::Domain("")) || self.scheme() == "file" {
|
|
|
@@ -2084,7 +2084,7 @@ impl Url {
|
|
|
/// # }
|
|
|
/// # run().unwrap();
|
|
|
/// ```
|
|
|
- #[allow(clippy::result_map_unit_fn)]
|
|
|
+ #[allow(clippy::result_unit_err, clippy::suspicious_operation_groupings)]
|
|
|
pub fn set_scheme(&mut self, scheme: &str) -> Result<(), ()> {
|
|
|
let mut parser = Parser::for_setter(String::new());
|
|
|
let remaining = parser.parse_scheme(parser::Input::new(scheme))?;
|
|
|
@@ -2164,7 +2164,7 @@ impl Url {
|
|
|
/// # }
|
|
|
/// ```
|
|
|
#[cfg(any(unix, windows, target_os = "redox"))]
|
|
|
- #[allow(clippy::result_map_unit_fn)]
|
|
|
+ #[allow(clippy::result_unit_err)]
|
|
|
pub fn from_file_path<P: AsRef<Path>>(path: P) -> Result<Url, ()> {
|
|
|
let mut serialization = "file://".to_owned();
|
|
|
let host_start = serialization.len() as u32;
|
|
|
@@ -2201,7 +2201,7 @@ impl Url {
|
|
|
/// Note that `std::path` does not consider trailing slashes significant
|
|
|
/// and usually does not include them (e.g. in `Path::parent()`).
|
|
|
#[cfg(any(unix, windows, target_os = "redox"))]
|
|
|
- #[allow(clippy::result_map_unit_fn)]
|
|
|
+ #[allow(clippy::result_unit_err)]
|
|
|
pub fn from_directory_path<P: AsRef<Path>>(path: P) -> Result<Url, ()> {
|
|
|
let mut url = Url::from_file_path(path)?;
|
|
|
if !url.serialization.ends_with('/') {
|
|
|
@@ -2318,7 +2318,7 @@ impl Url {
|
|
|
/// for a Windows path, is not UTF-8.)
|
|
|
#[inline]
|
|
|
#[cfg(any(unix, windows, target_os = "redox"))]
|
|
|
- #[allow(clippy::result_map_unit_fn)]
|
|
|
+ #[allow(clippy::result_unit_err)]
|
|
|
pub fn to_file_path(&self) -> Result<PathBuf, ()> {
|
|
|
if let Some(segments) = self.path_segments() {
|
|
|
let host = match self.host() {
|