Skip to content

Commit 172f299

Browse files
committed
Don't use bitflags_match macro
1 parent dc8fc74 commit 172f299

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

common/src/cformat.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Implementation of Printf-Style string formatting
22
//! as per the [Python Docs](https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting).
3-
use bitflags::{bitflags, bitflags_match};
3+
use bitflags::bitflags;
44
use itertools::Itertools;
55
use malachite_bigint::{BigInt, Sign};
66
use num_traits::Signed;
@@ -137,12 +137,13 @@ bitflags! {
137137
impl CConversionFlags {
138138
#[inline]
139139
pub fn sign_string(&self) -> &'static str {
140-
bitflags_match!(*self, {
141-
Self::SIGN_CHAR => "+",
142-
Self::BLANK_SIGN => " ",
143-
_ => "",
140+
if self.contains(Self::SIGN_CHAR) {
141+
"+"
142+
} else if self.contains(Self::BLANK_SIGN) {
143+
" "
144+
} else {
145+
""
144146
}
145-
)
146147
}
147148
}
148149

vm/src/function/method.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,15 @@ impl PyMethodDef {
107107
class: &'static Py<PyType>,
108108
ctx: &Context,
109109
) -> PyObjectRef {
110-
bitflags::bitflags_match!(self.flags, {
111-
PyMethodFlags::METHOD => self.build_method(ctx, class).into(),
112-
PyMethodFlags::CLASS => self.build_classmethod(ctx, class).into(),
113-
PyMethodFlags::STATIC => self.build_staticmethod(ctx, class).into(),
114-
_ => unreachable!(),
115-
})
110+
if self.flags.contains(PyMethodFlags::METHOD) {
111+
self.build_method(ctx, class).into()
112+
} else if self.flags.contains(PyMethodFlags::CLASS) {
113+
self.build_classmethod(ctx, class).into()
114+
} else if self.flags.contains(PyMethodFlags::STATIC) {
115+
self.build_staticmethod(ctx, class).into()
116+
} else {
117+
unreachable!()
118+
}
116119
}
117120

118121
pub const fn to_function(&'static self) -> PyNativeFunction {

0 commit comments

Comments
 (0)