google / google/googletest-rust

`expect_that!` message formatting uses an unqualified `format!`

Open
#819 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
432
Forks
36
Avg merge
7d 17h
Merged PRs (30d)
2

Description

Given:

```rust
expect_that!(x, eq(y), "{}", z());
```

I expect that this formats the message using `::core::format!`. However, it formats using an unqualified `format!`. Because my crate under test exports a macro named `format!` there is no way to force `googletest` use `core::format!` as I want it to. It's either ambiguous which `format!` it uses and it fails to compile, or it uses my local crate's `format!`, which is undesirable.

It is best practice for all macros to expand to fully-qualified paths whenever possible, as it allows the macro to function in environments without a prelude or where an ambiguous item is in scope.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.