Describe the bug
The generated code fails the clippy::str_to_string lint.
To Reproduce
src/main.rs
```rs
#![deny(clippy::str_to_string)]
struct A;
#[juniper::graphql_object]
impl A {
fn f() -> &'static str {
"a"
}
}
fn main() {
}
```
Cargo.toml
```toml
# Cargo.toml
[package]
name = "x"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
juniper = "0.15.10"
```
cargo clippy output
```
Checking x v0.1.0 (C:\Users\Dinu\proj\x)
error: `to_string()` called on a `&str`
--> src\main.rs:5:1
|
5 | #[juniper::graphql_object]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider using `.to_owned()`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#str_to_string
note: the lint level is defined here
--> src\main.rs:1:9
|
1 | #![deny(clippy::str_to_string)]
| ^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the attribute macro `juniper::graphql_object` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not compile `x` due to previous error
```
Expected behavior
The generated code to pass the lint, or at least ignore it.
Additional context
Add any other context about the problem here.
Describe the bug The generated code fails the
clippy::str_to_string
lint.To Reproduce
```rs #![deny(clippy::str_to_string)] struct A; #[juniper::graphql_object] impl A { fn f() -> &'static str { "a" } } fn main() { } ```src/main.rs
```toml # Cargo.toml [package] name = "x" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] juniper = "0.15.10" ```Cargo.toml
``` Checking x v0.1.0 (C:\Users\Dinu\proj\x) error: `to_string()` called on a `&str` --> src\main.rs:5:1 | 5 | #[juniper::graphql_object] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider using `.to_owned()` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#str_to_string note: the lint level is defined here --> src\main.rs:1:9 | 1 | #![deny(clippy::str_to_string)] | ^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the attribute macro `juniper::graphql_object` (in Nightly builds, run with -Z macro-backtrace for more info) error: could not compile `x` due to previous error ```cargo clippy
outputExpected behavior The generated code to pass the lint, or at least ignore it.
Additional context Add any other context about the problem here.
juniper
andjuniper_codegen
inCargo.lock