Miscellaneous small changes (#1238)

* Use a slice instead of a new object

* Remove unnecessary 'into_iter'

* Use 'and_then' instead of 'map_or'
This commit is contained in:
David Sinclair 2019-10-24 01:45:25 +02:00 committed by Osspial
parent 6608a0241d
commit 05a1f4280c
3 changed files with 2 additions and 6 deletions

View file

@ -208,7 +208,7 @@ pub fn scancode_to_keycode(scancode: c_ushort) -> Option<VirtualKeyCode> {
// While F1-F20 have scancodes we can match on, we have to check against UTF-16
// constants for the rest.
// https://developer.apple.com/documentation/appkit/1535851-function-key_unicodes?preferredLanguage=occ
pub fn check_function_keys(string: &String) -> Option<VirtualKeyCode> {
pub fn check_function_keys(string: &str) -> Option<VirtualKeyCode> {
if let Some(ch) = string.encode_utf16().next() {
return Some(match ch {
0xf718 => VirtualKeyCode::F21,