diff --git a/Cargo.lock b/Cargo.lock index b7381b4a0..45341036d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -330,7 +330,7 @@ version = "0.1.0" dependencies = [ "autocxx", "autocxx-build", - "bitflags 1.3.2", + "bitflags 2.4.0", "cc", "cxx", "cxx-build", diff --git a/Cargo.toml b/Cargo.toml index a56d077dd..b7a6128c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ hexponent = { git = "https://github.com/fish-shell/hexponent", branch="fish" } printf-compat = { git = "https://github.com/fish-shell/printf-compat.git", branch="fish" } autocxx = "0.23.1" -bitflags = "1.3.2" +bitflags = "2.4.0" cxx = "1.0" errno = "0.2.8" inventory = { version = "0.3.3", optional = true} diff --git a/fish-rust/src/builtins/path.rs b/fish-rust/src/builtins/path.rs index c15faced1..0cb9f47a2 100644 --- a/fish-rust/src/builtins/path.rs +++ b/fish-rust/src/builtins/path.rs @@ -52,7 +52,7 @@ fn arguments<'iter, 'args>( } bitflags! { - #[derive(Default)] + #[derive(Copy, Clone, Default)] pub struct TypeFlags: u32 { /// A block device const BLOCK = 1 << 0; @@ -91,7 +91,7 @@ fn try_from(value: &wstr) -> Result { } bitflags! { - #[derive(Default)] + #[derive(Copy, Clone, Default)] pub struct PermFlags: u32 { const READ = 1 << 0; const WRITE = 1 << 1; diff --git a/fish-rust/src/common.rs b/fish-rust/src/common.rs index c4d805ed6..4b1c2fd29 100644 --- a/fish-rust/src/common.rs +++ b/fish-rust/src/common.rs @@ -110,7 +110,7 @@ fn try_from(s: &wstr) -> Result { bitflags! { /// Flags for the [`escape_string()`] function. These are only applicable when the escape style is /// [`EscapeStringStyle::Script`]. - #[derive(Default)] + #[derive(Copy, Clone, Debug, Default, Eq, PartialEq)] pub struct EscapeFlags: u32 { /// Do not escape special fish syntax characters like the semicolon. Only escape non-printable /// characters and backslashes. @@ -153,7 +153,7 @@ fn try_from(s: &wstr) -> Result { bitflags! { /// Flags for unescape_string functions. - #[derive(Default)] + #[derive(Copy, Clone, Debug, Default, Eq, PartialEq)] pub struct UnescapeFlags: u32 { /// escape special fish syntax characters like the semicolon const SPECIAL = 1 << 0; diff --git a/fish-rust/src/complete.rs b/fish-rust/src/complete.rs index ea149c9a7..c11af3f40 100644 --- a/fish-rust/src/complete.rs +++ b/fish-rust/src/complete.rs @@ -19,7 +19,7 @@ pub struct CompletionMode { pub const PROG_COMPLETE_SEP: char = '\t'; bitflags! { - #[derive(Default)] + #[derive(Copy, Clone, Debug, Default, PartialEq, Eq)] pub struct CompleteFlags: u8 { /// Do not insert space afterwards if this is the only completion. (The default is to try insert /// a space). diff --git a/fish-rust/src/env/var.rs b/fish-rust/src/env/var.rs index d2bb8f913..a2dfda4c7 100644 --- a/fish-rust/src/env/var.rs +++ b/fish-rust/src/env/var.rs @@ -16,7 +16,7 @@ /// Flags that may be passed as the 'mode' in env_stack_t::set() / environment_t::get(). /// The default is empty. #[repr(C)] - #[derive(Default)] + #[derive(Copy, Clone, Default, PartialEq, Eq)] pub struct EnvMode: u16 { /// Flag for local (to the current block) variable. const LOCAL = 1 << 0; @@ -118,6 +118,7 @@ fn default() -> Self { } bitflags! { + #[derive(Copy, Clone, Debug, Default, PartialEq, Eq)] pub struct EnvVarFlags: u8 { const EXPORT = 1 << 0; // whether the variable is exported const READ_ONLY = 1 << 1; // whether the variable is read only diff --git a/fish-rust/src/expand.rs b/fish-rust/src/expand.rs index d92699ca5..d1b80d678 100644 --- a/fish-rust/src/expand.rs +++ b/fish-rust/src/expand.rs @@ -7,6 +7,7 @@ bitflags! { /// Set of flags controlling expansions. + #[derive(Copy, Clone, Default)] pub struct ExpandFlags : u16 { /// Skip command substitutions. const SKIP_CMDSUBST = 1 << 0; diff --git a/fish-rust/src/output.rs b/fish-rust/src/output.rs index 2d1545273..168afb16d 100644 --- a/fish-rust/src/output.rs +++ b/fish-rust/src/output.rs @@ -13,7 +13,7 @@ use std::sync::Mutex; bitflags! { - #[derive(Default)] + #[derive(Copy, Clone, Default)] pub struct ColorSupport: u8 { const TERM_256COLOR = 1<<0; const TERM_24BIT = 1<<1; diff --git a/fish-rust/src/parse_constants.rs b/fish-rust/src/parse_constants.rs index 70b20e8af..507d82540 100644 --- a/fish-rust/src/parse_constants.rs +++ b/fish-rust/src/parse_constants.rs @@ -15,6 +15,7 @@ pub const SOURCE_LOCATION_UNKNOWN: usize = usize::MAX; bitflags! { + #[derive(Copy, Clone, Default)] pub struct ParseTreeFlags: u8 { /// attempt to build a "parse tree" no matter what. this may result in a 'forest' of /// disconnected trees. this is intended to be used by syntax highlighting. @@ -34,7 +35,7 @@ pub struct ParseTreeFlags: u8 { } bitflags! { - #[derive(Default)] + #[derive(Copy, Clone, Default, Eq, PartialEq)] pub struct ParserTestErrorBits: u8 { const ERROR = 1; const INCOMPLETE = 2; diff --git a/fish-rust/src/wcstringutil.rs b/fish-rust/src/wcstringutil.rs index 5bd2fa0b3..c23d58aa4 100644 --- a/fish-rust/src/wcstringutil.rs +++ b/fish-rust/src/wcstringutil.rs @@ -98,7 +98,7 @@ pub enum CaseFold { } /// A lightweight value-type describing how closely a string fuzzy-matches another string. -#[derive(Debug, Eq, PartialEq, Clone)] +#[derive(Copy, Clone, Debug, Eq, PartialEq)] pub struct StringFuzzyMatch { pub typ: ContainType, pub case_fold: CaseFold,