Make KeyEvent::new a const fn (#606)

This commit is contained in:
Canop 2021-10-11 21:04:59 +02:00 committed by GitHub
parent d638d15cd4
commit fe5c303fcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -395,7 +395,7 @@ pub struct KeyEvent {
}
impl KeyEvent {
pub fn new(code: KeyCode, modifiers: KeyModifiers) -> KeyEvent {
pub const fn new(code: KeyCode, modifiers: KeyModifiers) -> KeyEvent {
KeyEvent { code, modifiers }
}

View File

@ -85,7 +85,7 @@ impl Attributes {
/// Returns whether the attribute is set.
#[inline(always)]
pub fn has(self, attribute: Attribute) -> bool {
pub const fn has(self, attribute: Attribute) -> bool {
self.0 & attribute.bytes() != 0
}
@ -97,7 +97,7 @@ impl Attributes {
/// Returns whether there is no attribute set.
#[inline(always)]
pub fn is_empty(self) -> bool {
pub const fn is_empty(self) -> bool {
self.0 == 0
}
}