diff options
-rwxr-xr-x | tests/rust | 1 | ||||
-rw-r--r-- | tests/rust-test/src/main.rs | 7 | ||||
-rwxr-xr-x | tools/keymap-gen | 6 |
3 files changed, 10 insertions, 4 deletions
@@ -2,3 +2,4 @@ cd rust-test cargo test +cargo clippy diff --git a/tests/rust-test/src/main.rs b/tests/rust-test/src/main.rs index 019c3d4..ba165d0 100644 --- a/tests/rust-test/src/main.rs +++ b/tests/rust-test/src/main.rs @@ -7,7 +7,6 @@ include!("../../osx2xkb.rs"); include!("../../osx_name.rs"); include!("../../osx.rs"); -#[test] fn main() { assert_eq!(CODE_MAP_OSX_TO_WIN32[0x1d], 0x30); assert_eq!(NAME_MAP_OSX_TO_WIN32[0x1d], "VK_0"); @@ -21,3 +20,9 @@ fn main() { assert_eq!(CODE_TABLE_OSX[0x1d], 0x3b); assert_eq!(NAME_TABLE_OSX[0x1d], "Control"); } + + +#[test] +fn test() { + main() +} diff --git a/tools/keymap-gen b/tools/keymap-gen index 4e2fafd..ac4b057 100755 --- a/tools/keymap-gen +++ b/tools/keymap-gen @@ -765,11 +765,11 @@ class RustLanguageGenerator(LanguageSrcGenerator): if fromtype == self.TYPE_ENUM: raise NotImplementedError("Enums not supported as source in Rust generator") - totypename = "&'static str" if totype == self.TYPE_STRING else "u16" + totypename = "&str" if totype == self.TYPE_STRING else "u16" if fromtype != self.TYPE_STRING: - print("pub static %s: &'static [%s] = &[" % (varname.upper(), totypename)) + print("pub static %s: &[%s] = &[" % (varname.upper(), totypename)) else: - print("pub static %s: phf::Map<&'static str, %s> = phf::phf_map! {" % + print("pub static %s: phf::Map<&str, %s> = phf::phf_map! {" % (varname.upper(), totypename)) def _array_end(self, fromtype, totype): |