From d1474ae51806cd5382c988fac1cf70a7f2718f4a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 4 Apr 2021 12:06:01 +0300 Subject: Check if bitflags deps pulls its weight Bitflags is generally a good dependency -- it's lightweight, well maintained and embraced by the ecosystem. I wonder, however, do we really need it? Doesn't feel like it adds much to be honest. --- crates/hir_def/src/item_tree.rs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'crates/hir_def/src/item_tree.rs') diff --git a/crates/hir_def/src/item_tree.rs b/crates/hir_def/src/item_tree.rs index c6d700977..739906778 100644 --- a/crates/hir_def/src/item_tree.rs +++ b/crates/hir_def/src/item_tree.rs @@ -569,20 +569,21 @@ pub enum Param { Varargs, } -bitflags::bitflags! { - /// NOTE: Shared with `FunctionData` - pub(crate) struct FnFlags: u8 { - const HAS_SELF_PARAM = 1 << 0; - const HAS_BODY = 1 << 1; - const IS_DEFAULT = 1 << 2; - const IS_CONST = 1 << 3; - const IS_ASYNC = 1 << 4; - const IS_UNSAFE = 1 << 5; - /// Whether the function is located in an `extern` block (*not* whether it is an - /// `extern "abi" fn`). - const IS_IN_EXTERN_BLOCK = 1 << 6; - const IS_VARARGS = 1 << 7; - } +#[derive(Debug, Clone, Copy, Eq, PartialEq, Default)] +pub(crate) struct FnFlags { + pub(crate) bits: u8, +} +impl FnFlags { + pub(crate) const HAS_SELF_PARAM: u8 = 1 << 0; + pub(crate) const HAS_BODY: u8 = 1 << 1; + pub(crate) const IS_DEFAULT: u8 = 1 << 2; + pub(crate) const IS_CONST: u8 = 1 << 3; + pub(crate) const IS_ASYNC: u8 = 1 << 4; + pub(crate) const IS_UNSAFE: u8 = 1 << 5; + /// Whether the function is located in an `extern` block (*not* whether it is an + /// `extern "abi" fn`). + pub(crate) const IS_IN_EXTERN_BLOCK: u8 = 1 << 6; + pub(crate) const IS_VARARGS: u8 = 1 << 7; } #[derive(Debug, Clone, Eq, PartialEq)] -- cgit v1.2.3