Skip to content

Commit 4d2ef08

Browse files
committed
Fix clippy warnings
1 parent 47d43a9 commit 4d2ef08

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/lib.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl SimpleError {
101101
// TODO: implement From<T> where T: std::error::Error when specialization lands, and remove
102102
// inherent from function.
103103

104-
impl<'a> From<&'a str> for SimpleError {
104+
impl From<&str> for SimpleError {
105105
#[inline]
106106
fn from(s: &str) -> SimpleError {
107107
SimpleError{ err: s.into() }
@@ -417,15 +417,18 @@ mod tests {
417417
}
418418

419419
fn try_block(result: Result<(), SimpleError>, s: &str) -> Result<(), SimpleError> {
420-
Ok(try_with!(result, s))
420+
let _: () = try_with!(result, s);
421+
Ok(())
421422
}
422423

423424
fn try_block_format(result: Result<(), SimpleError>, s: &str) -> Result<(), SimpleError> {
424-
Ok(try_with!(result, "with {}", s))
425+
let _: () = try_with!(result, "with {}", s);
426+
Ok(())
425427
}
426428

427429
fn try_block_format_with_capture(result: Result<(), SimpleError>, s: &str) -> Result<(), SimpleError> {
428-
Ok(try_with!(result, "with {s}"))
430+
let _: () = try_with!(result, "with {s}");
431+
Ok(())
429432
}
430433

431434
#[test]
@@ -437,19 +440,23 @@ mod tests {
437440
}
438441

439442
fn require_block(option: Option<()>, s: &str) -> Result<(), SimpleError> {
440-
Ok(require_with!(option, s))
443+
let _: () = require_with!(option, s);
444+
Ok(())
441445
}
442446

443447
fn require_block_str_as_ref(option: Option<()>, s: &String) -> Result<(), SimpleError> {
444-
Ok(require_with!(option, s))
448+
let _: () = require_with!(option, s);
449+
Ok(())
445450
}
446451

447452
fn require_block_format(maybe: Option<()>, s: &str) -> Result<(), SimpleError> {
448-
Ok(require_with!(maybe, "with {}", s))
453+
let _: () = require_with!(maybe, "with {}", s);
454+
Ok(())
449455
}
450456

451457
fn require_block_format_with_capture(maybe: Option<()>, s: &str) -> Result<(), SimpleError> {
452-
Ok(require_with!(maybe, "with {s}"))
458+
let _: () = require_with!(maybe, "with {s}");
459+
Ok(())
453460
}
454461

455462
#[test]

0 commit comments

Comments
 (0)