Skip to content

Conversation

@HelloShiv
Copy link
Contributor

Used assert! statement instead of alert, to indicate a failed condition without stopping the program immediately.

if e.kind() != ErrorKind::AlreadyExists {
    assert!(false, "Failed to create sym link: {:?}", e);
}

@codecov
Copy link

codecov bot commented Apr 2, 2023

Codecov Report

Merging #227 (72a684d) into main (0e4517b) will not change coverage.
The diff coverage is n/a.

❗ Current head 72a684d differs from pull request most recent head d7de766. Consider uploading reports for the commit d7de766 to get more accurate results

@@           Coverage Diff           @@
##             main     #227   +/-   ##
=======================================
  Coverage   58.61%   58.61%           
=======================================
  Files          30       30           
  Lines        3542     3542           
  Branches      785      785           
=======================================
  Hits         2076     2076           
  Misses       1170     1170           
  Partials      296      296           
Impacted Files Coverage Δ
src/find/matchers/lname.rs 76.19% <ø> (ø)
src/find/matchers/name.rs 100.00% <ø> (ø)
src/find/matchers/printf.rs 70.62% <ø> (ø)
src/find/matchers/type_matcher.rs 88.23% <ø> (ø)
src/find/mod.rs 66.33% <ø> (ø)
tests/find_cmd_tests.rs 90.29% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@sylvestre
Copy link
Contributor

you should follow the recommendation:

   | |_____________^ help: try instead: `assert!(!(e.kind() != ErrorKind::AlreadyExists), "Failed to create sym link: {:?}", e);

Copy link
Member

@tertsdiepraam tertsdiepraam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I think we can clean up just a bit more than what clippy suggests by removing the double negation.

panic!("Failed to create sym link: {:?}", e);
}
assert!(
!(e.kind() != ErrorKind::AlreadyExists),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a double negation here now that can be removed:

Suggested change
!(e.kind() != ErrorKind::AlreadyExists),
e.kind() == ErrorKind::AlreadyExists,

Clippy probably would suggest the same thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implementing it

@sylvestre sylvestre merged commit 2011a7a into uutils:main Apr 7, 2023
@HelloShiv HelloShiv deleted the warning_panic_#226 branch April 7, 2023 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants