chore(rustfmt): use nightly (#2325)

Stable rustfmt lacks a lot of features resulting in worse formatted
code, thus use nightly formatter.
This commit is contained in:
Kirill Chibisov 2024-04-26 19:11:44 +04:00 committed by GitHub
parent 7006c7ceca
commit 7b0c7b6cb2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
154 changed files with 3439 additions and 5891 deletions

View file

@ -106,23 +106,23 @@ impl std::fmt::Debug for NativeKeyCode {
match self {
Unidentified => {
debug_tuple = f.debug_tuple("Unidentified");
}
},
Android(code) => {
debug_tuple = f.debug_tuple("Android");
debug_tuple.field(&format_args!("0x{code:04X}"));
}
},
MacOS(code) => {
debug_tuple = f.debug_tuple("MacOS");
debug_tuple.field(&format_args!("0x{code:04X}"));
}
},
Windows(code) => {
debug_tuple = f.debug_tuple("Windows");
debug_tuple.field(&format_args!("0x{code:04X}"));
}
},
Xkb(code) => {
debug_tuple = f.debug_tuple("Xkb");
debug_tuple.field(&format_args!("0x{code:04X}"));
}
},
}
debug_tuple.finish()
}
@ -162,27 +162,27 @@ impl std::fmt::Debug for NativeKey {
match self {
Unidentified => {
debug_tuple = f.debug_tuple("Unidentified");
}
},
Android(code) => {
debug_tuple = f.debug_tuple("Android");
debug_tuple.field(&format_args!("0x{code:04X}"));
}
},
MacOS(code) => {
debug_tuple = f.debug_tuple("MacOS");
debug_tuple.field(&format_args!("0x{code:04X}"));
}
},
Windows(code) => {
debug_tuple = f.debug_tuple("Windows");
debug_tuple.field(&format_args!("0x{code:04X}"));
}
},
Xkb(code) => {
debug_tuple = f.debug_tuple("Xkb");
debug_tuple.field(&format_args!("0x{code:04X}"));
}
},
Web(code) => {
debug_tuple = f.debug_tuple("Web");
debug_tuple.field(code);
}
},
}
debug_tuple.finish()
}
@ -442,7 +442,8 @@ pub enum KeyCode {
Tab,
/// Japanese: <kbd>変</kbd> (henkan)
Convert,
/// Japanese: <kbd>カタカナ</kbd>/<kbd>ひらがな</kbd>/<kbd>ローマ字</kbd> (katakana/hiragana/romaji)
/// Japanese: <kbd>カタカナ</kbd>/<kbd>ひらがな</kbd>/<kbd>ローマ字</kbd>
/// (katakana/hiragana/romaji)
KanaMode,
/// Korean: HangulMode <kbd>한/영</kbd> (han/yeong)
///
@ -490,7 +491,8 @@ pub enum KeyCode {
NumLock,
/// <kbd>0 Ins</kbd> on a keyboard. <kbd>0</kbd> on a phone or remote control
Numpad0,
/// <kbd>1 End</kbd> on a keyboard. <kbd>1</kbd> or <kbd>1 QZ</kbd> on a phone or remote control
/// <kbd>1 End</kbd> on a keyboard. <kbd>1</kbd> or <kbd>1 QZ</kbd> on a phone or remote
/// control
Numpad1,
/// <kbd>2 ↓</kbd> on a keyboard. <kbd>2 ABC</kbd> on a phone or remote control
Numpad2,
@ -794,13 +796,14 @@ pub enum NamedKey {
// Legacy modifier key.
Hyper,
/// Used to enable "super" modifier function for interpreting concurrent or subsequent keyboard
/// input. This key value is used for the "Windows Logo" key and the Apple `Command` or `⌘` key.
/// input. This key value is used for the "Windows Logo" key and the Apple `Command` or `⌘`
/// key.
///
/// Note: In some contexts (e.g. the Web) this is referred to as the "Meta" key.
Super,
/// The `Enter` or `↵` key. Used to activate current selection or accept current input. This key
/// value is also used for the `Return` (Macintosh numpad) key. This key value is also used for
/// the Android `KEYCODE_DPAD_CENTER`.
/// The `Enter` or `↵` key. Used to activate current selection or accept current input. This
/// key value is also used for the `Return` (Macintosh numpad) key. This key value is also
/// used for the Android `KEYCODE_DPAD_CENTER`.
Enter,
/// The Horizontal Tabulation `Tab` key.
Tab,
@ -836,8 +839,8 @@ pub enum NamedKey {
CrSel,
/// Cut the current selection. (`APPCOMMAND_CUT`)
Cut,
/// Used to delete the character to the right of the cursor. This key value is also used for the
/// key labeled `Delete` on MacOS keyboards when `Fn` is active.
/// Used to delete the character to the right of the cursor. This key value is also used for
/// the key labeled `Delete` on MacOS keyboards when `Fn` is active.
Delete,
/// The Erase to End of Field key. This key deletes all characters from the current cursor
/// position to the end of the current field.
@ -921,8 +924,8 @@ pub enum NamedKey {
/// their code points.
CodeInput,
/// The Compose key, also known as "Multi_key" on the X Window System. This key acts in a
/// manner similar to a dead key, triggering a mode where subsequent key presses are combined to
/// produce a different character.
/// manner similar to a dead key, triggering a mode where subsequent key presses are combined
/// to produce a different character.
Compose,
/// Convert the current input method sequence.
Convert,
@ -961,9 +964,9 @@ pub enum NamedKey {
/// The Kana Mode (Kana Lock) key. This key is used to enter hiragana mode (typically from
/// romaji mode).
KanaMode,
/// The Kanji (Japanese name for ideographic characters of Chinese origin) Mode key. This key is
/// typically used to switch to a hiragana keyboard for the purpose of converting input into
/// kanji. (`KEYCODE_KANA`)
/// The Kanji (Japanese name for ideographic characters of Chinese origin) Mode key. This key
/// is typically used to switch to a hiragana keyboard for the purpose of converting input
/// into kanji. (`KEYCODE_KANA`)
KanjiMode,
/// The Katakana (Japanese Kana characters) key.
Katakana,
@ -1588,7 +1591,7 @@ impl Key {
/// # Examples
///
/// ```
/// use winit::keyboard::{NamedKey, Key};
/// use winit::keyboard::{Key, NamedKey};
///
/// assert_eq!(Key::Character("a".into()).to_text(), Some("a"));
/// assert_eq!(Key::Named(NamedKey::Enter).to_text(), Some("\r"));
@ -1610,7 +1613,8 @@ impl Key {
/// keys can be above the letters or on the numpad. This enum allows the user to differentiate
/// them.
///
/// See the documentation for the [`location`] field on the [`KeyEvent`] struct for more information.
/// See the documentation for the [`location`] field on the [`KeyEvent`] struct for more
/// information.
///
/// [`location`]: ../event/struct.KeyEvent.html#structfield.location
/// [`KeyEvent`]: crate::event::KeyEvent
@ -1619,8 +1623,8 @@ impl Key {
pub enum KeyLocation {
/// The key is in its "normal" location on the keyboard.
///
/// For instance, the "1" key above the "Q" key on a QWERTY keyboard will use this location. This
/// invariant is also returned when the location of the key cannot be identified.
/// For instance, the "1" key above the "Q" key on a QWERTY keyboard will use this location.
/// This invariant is also returned when the location of the key cannot be identified.
///
/// ![Standard 1 key](https://raw.githubusercontent.com/rust-windowing/winit/master/docs/res/keyboard_standard_1_key.svg)
///
@ -1703,14 +1707,17 @@ impl ModifiersState {
pub fn shift_key(&self) -> bool {
self.intersects(Self::SHIFT)
}
/// Returns `true` if the control key is pressed.
pub fn control_key(&self) -> bool {
self.intersects(Self::CONTROL)
}
/// Returns `true` if the alt key is pressed.
pub fn alt_key(&self) -> bool {
self.intersects(Self::ALT)
}
/// Returns `true` if the super key is pressed.
pub fn super_key(&self) -> bool {
self.intersects(Self::SUPER)
@ -1784,12 +1791,8 @@ mod modifiers_serde {
where
D: Deserializer<'de>,
{
let ModifiersStateSerialize {
shift_key,
control_key,
alt_key,
super_key,
} = ModifiersStateSerialize::deserialize(deserializer)?;
let ModifiersStateSerialize { shift_key, control_key, alt_key, super_key } =
ModifiersStateSerialize::deserialize(deserializer)?;
let mut m = ModifiersState::empty();
m.set(ModifiersState::SHIFT, shift_key);
m.set(ModifiersState::CONTROL, control_key);