Remove use of unreachable in favor of internal errors

type: reform
pr: https://github.com/casey/intermodal/pull/351
fixes:
- https://github.com/casey/intermodal/issues/188
This commit is contained in:
Casey Rodarmor 2020-04-09 19:22:37 -07:00
parent 52b78b90f6
commit e54bdeb95d
No known key found for this signature in database
GPG Key ID: 556186B153EC6FE0
6 changed files with 13 additions and 9 deletions

View File

@ -4,7 +4,8 @@ Changelog
UNRELEASED - 2020-04-10 UNRELEASED - 2020-04-10
----------------------- -----------------------
- :books: [`xxxxxxxxxxxx`](https://github.com/casey/intermodal/commits/master) Improve badges - _Casey Rodarmor <casey@rodarmor.com>_ - :art: [`xxxxxxxxxxxx`](https://github.com/casey/intermodal/commits/master) Remove use of unreachable in favor of internal errors ([#351](https://github.com/casey/intermodal/pull/351)) - Fixes [#188](https://github.com/casey/intermodal/issues/188) - _Casey Rodarmor <casey@rodarmor.com>_
- :books: [`52b78b90f675`](https://github.com/casey/intermodal/commit/52b78b90f6751a72a64074619fbf19df2988ac14) Improve badges ([#350](https://github.com/casey/intermodal/pull/350)) - _Casey Rodarmor <casey@rodarmor.com>_
[v0.1.3](https://github.com/casey/intermodal/releases/tag/v0.1.3) - 2020-04-10 [v0.1.3](https://github.com/casey/intermodal/releases/tag/v0.1.3) - 2020-04-10

View File

@ -19,7 +19,7 @@ stats PATH:
cargo build --release cargo build --release
time ./target/release/imdl --unstable torrent stats --input {{PATH}} time ./target/release/imdl --unstable torrent stats --input {{PATH}}
push: check push:
! git branch | grep '* master' ! git branch | grep '* master'
git push github git push github
@ -36,7 +36,7 @@ test:
cargo test --all cargo test --all
clippy: clippy:
RUSTFLAGS="-D warnings" cargo clippy --all cargo clippy --all
fmt: fmt:
cargo +nightly fmt --all cargo +nightly fmt --all
@ -98,7 +98,7 @@ check: test clippy lint check-minimal-versions changelog-update
draft: push draft: push
hub pull-request -o --draft hub pull-request -o --draft
pr: push pr: check push
hub pull-request -o hub pull-request -o
merge: merge:
@ -110,7 +110,6 @@ merge:
just done just done
update: man changelog-update update-toc update: man changelog-update update-toc
cargo update
publish-check: check check-man publish-check: check check-man
cargo outdated --exit-code 1 cargo outdated --exit-code 1

View File

@ -176,7 +176,7 @@ impl From<walkdir::Error> for Error {
if let Some(source) = walkdir_error.into_io_error() { if let Some(source) = walkdir_error.into_io_error() {
Self::Filesystem { source, path } Self::Filesystem { source, path }
} else { } else {
unreachable!("Encountered unexpected walkdir error") Self::internal("Encountered walkdir error without source")
} }
} }
} }

View File

@ -88,7 +88,12 @@ impl Print for FileError {
Self::Directory => write!(stream, "Expected file but found directory")?, Self::Directory => write!(stream, "Expected file but found directory")?,
Self::Surfeit(difference) => write!(stream, "{} too long", difference)?, Self::Surfeit(difference) => write!(stream, "{} too long", difference)?,
Self::Dearth(difference) => write!(stream, "{} too short", difference)?, Self::Dearth(difference) => write!(stream, "{} too short", difference)?,
Self::Md5 { .. } => unreachable!(), Self::Md5 { .. } => {
return Err(io::Error::new(
io::ErrorKind::Other,
Error::internal("Reached unreachable branch").to_string(),
))
}
} }
Ok(()) Ok(())

View File

@ -18,7 +18,6 @@
clippy::result_unwrap_used, clippy::result_unwrap_used,
clippy::shadow_reuse, clippy::shadow_reuse,
clippy::too_many_lines, clippy::too_many_lines,
clippy::unreachable,
clippy::unseparated_literal_suffix, clippy::unseparated_literal_suffix,
clippy::wildcard_enum_match_arm clippy::wildcard_enum_match_arm
)] )]

View File

@ -17,7 +17,7 @@ impl PieceLength {
"Content".into(), "Content".into(),
"Piece Length".into(), "Piece Length".into(),
"Count".into(), "Count".into(),
"Metainfo Size".into(), "Piece List Size".into(),
)); ));
for i in 14..51 { for i in 14..51 {