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

Fix up some clippy lints #302

Merged
merged 1 commit into from Feb 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 11 additions & 15 deletions src/lib.rs
Expand Up @@ -433,14 +433,12 @@ The macros are split into 3 modules:
/// }
/// }
///
/// fn main() {
/// let e1 = Flags::A | Flags::C;
/// let e2 = Flags::B | Flags::C;
/// assert_eq!((e1 | e2), Flags::ABC); // union
/// assert_eq!((e1 & e2), Flags::C); // intersection
/// assert_eq!((e1 - e2), Flags::A); // set difference
/// assert_eq!(!e2, Flags::A); // set complement
/// }
/// let e1 = Flags::A | Flags::C;
/// let e2 = Flags::B | Flags::C;
/// assert_eq!((e1 | e2), Flags::ABC); // union
/// assert_eq!((e1 & e2), Flags::C); // intersection
/// assert_eq!((e1 - e2), Flags::A); // set difference
/// assert_eq!(!e2, Flags::A); // set complement
/// ```
///
/// The generated `struct`s can also be extended with type and trait
Expand All @@ -465,15 +463,13 @@ The macros are split into 3 modules:
/// }
/// }
///
/// fn main() {
/// let mut flags = Flags::A | Flags::B;
/// let mut flags = Flags::A | Flags::B;
///
/// flags.clear();
/// assert!(flags.is_empty());
/// flags.clear();
/// assert!(flags.is_empty());
///
/// assert_eq!(format!("{:?}", Flags::A | Flags::B), "Flags(A | B)");
/// assert_eq!(format!("{:?}", Flags::B), "Flags(B)");
/// }
/// assert_eq!(format!("{:?}", Flags::A | Flags::B), "Flags(A | B)");
/// assert_eq!(format!("{:?}", Flags::B), "Flags(B)");
/// ```
#[macro_export(local_inner_macros)]
macro_rules! bitflags {
Expand Down
3 changes: 3 additions & 0 deletions src/parser.rs
Expand Up @@ -14,13 +14,16 @@
//! A | B | 0x0c
//! ```

#![allow(clippy::let_unit_value)]

use core::fmt;

/// An error encountered while parsing flags from text.
#[derive(Debug)]
pub struct ParseError(ParseErrorKind);

#[derive(Debug)]
#[allow(clippy::enum_variant_names)]
enum ParseErrorKind {
EmptyFlag,
InvalidNamedFlag {
Expand Down