Skip to content

Commit 2601e4e

Browse files
boundless-forestByron
authored andcommitted
Update to 2021 edition and remove Sized bound
1 parent a49e9cc commit 2601e4e

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name = "open"
44
version = "2.1.0"
55
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
66
license = "MIT"
7-
edition = "2018"
7+
edition = "2021"
88
readme = "README.md"
99
description = "Open a path or URL using the program configured on the system"
1010
repository = "https://github.com/Byron/open-rs"

src/lib.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ type Result = io::Result<()>;
9191
///
9292
/// A [`std::io::Error`] is returned on failure. Because different operating systems
9393
/// handle errors differently it is recommend to not match on a certain error.
94-
pub fn that<T: AsRef<OsStr> + Sized>(path: T) -> Result {
94+
pub fn that<T: AsRef<OsStr>>(path: T) -> Result {
9595
os::that(path)
9696
}
9797

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

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

128128
/// Open path with the given application in a new thread.
129129
///
130130
/// See documentation of [`with`] for more details.
131-
pub fn with_in_background<T: AsRef<OsStr> + Sized>(
131+
pub fn with_in_background<T: AsRef<OsStr>>(
132132
path: T,
133133
app: impl Into<String>,
134134
) -> thread::JoinHandle<Result> {
@@ -227,7 +227,7 @@ mod windows {
227227
Ok(maybe_result)
228228
}
229229

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

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

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

251251
let path = convert_path(path.as_ref())?;
@@ -273,14 +273,14 @@ mod macos {
273273

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

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

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

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

299-
pub fn that<T: AsRef<OsStr> + Sized>(path: T) -> Result {
299+
pub fn that<T: AsRef<OsStr>>(path: T) -> Result {
300300
Command::new("uiopen")
301301
.arg("--url")
302302
.arg(path.as_ref())
303303
.output_stderr()
304304
.into_result()
305305
}
306306

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

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

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

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

0 commit comments

Comments
 (0)