Skip to content

Commit

Permalink
Update to 2021 edition and remove Sized bound
Browse files Browse the repository at this point in the history
  • Loading branch information
boundless-forest authored and Byron committed Mar 5, 2022
1 parent a49e9cc commit 2601e4e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "open"
version = "2.1.0"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
license = "MIT"
edition = "2018"
edition = "2021"
readme = "README.md"
description = "Open a path or URL using the program configured on the system"
repository = "https://github.com/Byron/open-rs"
Expand Down
24 changes: 12 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ type Result = io::Result<()>;
///
/// A [`std::io::Error`] is returned on failure. Because different operating systems
/// handle errors differently it is recommend to not match on a certain error.
pub fn that<T: AsRef<OsStr> + Sized>(path: T) -> Result {
pub fn that<T: AsRef<OsStr>>(path: T) -> Result {
os::that(path)
}

Expand All @@ -113,22 +113,22 @@ pub fn that<T: AsRef<OsStr> + Sized>(path: T) -> Result {
///
/// A [`std::io::Error`] is returned on failure. Because different operating systems
/// handle errors differently it is recommend to not match on a certain error.
pub fn with<T: AsRef<OsStr> + Sized>(path: T, app: impl Into<String>) -> Result {
pub fn with<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> Result {
os::with(path, app)
}

/// Open path with the default application in a new thread.
///
/// See documentation of [`that`] for more details.
pub fn that_in_background<T: AsRef<OsStr> + Sized>(path: T) -> thread::JoinHandle<Result> {
pub fn that_in_background<T: AsRef<OsStr>>(path: T) -> thread::JoinHandle<Result> {
let path = path.as_ref().to_os_string();
thread::spawn(|| that(path))
}

/// Open path with the given application in a new thread.
///
/// See documentation of [`with`] for more details.
pub fn with_in_background<T: AsRef<OsStr> + Sized>(
pub fn with_in_background<T: AsRef<OsStr>>(
path: T,
app: impl Into<String>,
) -> thread::JoinHandle<Result> {
Expand Down Expand Up @@ -227,7 +227,7 @@ mod windows {
Ok(maybe_result)
}

pub fn that<T: AsRef<OsStr> + Sized>(path: T) -> Result {
pub fn that<T: AsRef<OsStr>>(path: T) -> Result {
const SW_SHOW: c_int = 5;

let path = convert_path(path.as_ref())?;
Expand All @@ -245,7 +245,7 @@ mod windows {
(result as c_int).into_result()
}

pub fn with<T: AsRef<OsStr> + Sized>(path: T, app: impl Into<String>) -> Result {
pub fn with<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> Result {
const SW_SHOW: c_int = 5;

let path = convert_path(path.as_ref())?;
Expand Down Expand Up @@ -273,14 +273,14 @@ mod macos {

use crate::{CommandExt, IntoResult, Result};

pub fn that<T: AsRef<OsStr> + Sized>(path: T) -> Result {
pub fn that<T: AsRef<OsStr>>(path: T) -> Result {
Command::new("/usr/bin/open")
.arg(path.as_ref())
.output_stderr()
.into_result()
}

pub fn with<T: AsRef<OsStr> + Sized>(path: T, app: impl Into<String>) -> Result {
pub fn with<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> Result {
Command::new("/usr/bin/open")
.arg(path.as_ref())
.arg("-a")
Expand All @@ -296,15 +296,15 @@ mod ios {

use crate::{CommandExt, IntoResult, Result};

pub fn that<T: AsRef<OsStr> + Sized>(path: T) -> Result {
pub fn that<T: AsRef<OsStr>>(path: T) -> Result {
Command::new("uiopen")
.arg("--url")
.arg(path.as_ref())
.output_stderr()
.into_result()
}

pub fn with<T: AsRef<OsStr> + Sized>(path: T, app: impl Into<String>) -> Result {
pub fn with<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> Result {
Command::new("uiopen")
.arg("--url")
.arg(path.as_ref())
Expand Down Expand Up @@ -335,7 +335,7 @@ mod unix {

use crate::{CommandExt, IntoResult, Result};

pub fn that<T: AsRef<OsStr> + Sized>(path: T) -> Result {
pub fn that<T: AsRef<OsStr>>(path: T) -> Result {
let path = path.as_ref();
let open_handlers = [
("xdg-open", &[path] as &[_]),
Expand Down Expand Up @@ -363,7 +363,7 @@ mod unix {
.expect("successful cases don't get here"))
}

pub fn with<T: AsRef<OsStr> + Sized>(path: T, app: impl Into<String>) -> Result {
pub fn with<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> Result {
Command::new(app.into())
.arg(path.as_ref())
.output_stderr()
Expand Down

0 comments on commit 2601e4e

Please sign in to comment.