Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatted with cargo clippy and removed redundant code #6

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

TadaHrd
Copy link

@TadaHrd TadaHrd commented Aug 24, 2024

  • #[doc(hidden)] is redundant on private items unless you compile docs with --document-private-items
  • redundant lifetimes in Hotp and Totp methods.
  • todo!() in generate_otpauth_url
  • number operations like x / 1 or x & 0xFF removed in favor of *x.
  • assert_eq!(x, true) replaced with assert!(x), same with false.

There are still things that I haven't done that could be done:

  • set the edition to 2021, it should be compatible
  • use debug_assert to optimize for release builds
  • add explanations into assertions (e.g. assert!(cond, "cond was false, that shouldn't happen"))
  • add support for otpauth URL generation (I could make a PR if you wanted)
  • put generate_otpauth_url behind a feature in the Cargo.toml file

Note:

  • the secret should be in base32, at least for otpauth URLs
  • I did not bump the version in Cargo.toml

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.

1 participant