Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes for Rust code generation #495

Merged
merged 1 commit into from
Jun 10, 2022

Conversation

travis79
Copy link
Member

@travis79 travis79 commented Jun 9, 2022

  • Changes the Rust jinja template to use the extra_metric_args format more like the other language templates.
  • Adds full qualification of String to std::string::String to silence Rust errors

@travis79 travis79 requested a review from badboy June 9, 2022 14:39
@@ -32,10 +32,10 @@ pub struct {{ obj.name|Camelize }}{{ suffix }} {
impl ExtraKeys for {{ obj.name|Camelize }}{{ suffix }} {
const ALLOWED_KEYS: &'static [&'static str] = {{ obj.allowed_extra_keys|extra_keys }};

fn into_ffi_extra(self) -> ::std::collections::HashMap<String, String> {
fn into_ffi_extra(self) -> ::std::collections::HashMap<std::string::String, std::string::String> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use full qualificaation here, as the hashmap also uses with a :: prefix

Suggested change
fn into_ffi_extra(self) -> ::std::collections::HashMap<std::string::String, std::string::String> {
fn into_ffi_extra(self) -> ::std::collections::HashMap<::std::string::String, ::std::string::String> {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that should work at least.

- Changes the Rust jinja template to use the `extra_metric_args` format more like the other language templates.
- Adds full qualification of `String` to `std::string::String` to silence Rust errors
@travis79 travis79 merged commit d4b2164 into mozilla:main Jun 10, 2022
@travis79 travis79 deleted the rust-template-fixes branch June 10, 2022 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants