Skip to content

Fix uninlined_format_args in server codegen #4366

@ysaito1001

Description

@ysaito1001

Bumping MSRV to 1.88.0 required us to fix uninlined_format_args throughout the codebase, e.g.
Fix from:

format!("{}", abc);

To:

format!("{abc}");

The server codegen encountered the warning in the following context:

   --> pokemon-service-server-sdk/src/input.rs:813:58
    |
813 | ...                   message: format!("Value at '{}/events' failed to satisfy constraint: Member must not be null", path),
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
    |
813 -                                                 message: format!("Value at '{}/events' failed to satisfy constraint: Member must not be null", path),
813 +                                                 message: format!("Value at '{path}/events' failed to satisfy constraint: Member must not be null"),
    |

This format string is rendered by a helper function like this. Therefore, it seems to take more than moving a variable name into a curly brace in the format! string.

To work around this temporarily, the server codegen allows uninlined_format_args in libRsCustomizations in ServerRequiredCustomizations. Remove this work around once the server codegen codebase is free from uninlined_format_args.

The issues were found in the following CI steps:

  • check-server-codegen-integration-tests
  • check-server-codegen-integration-tests-python
  • check-server-e2e-test
  • check-server-python-e2e-test

It's locally reproducible by removing the workaround above from libRsCustomizations and running ./gradlew codegen-server-test:test for instance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    serverRust server SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions