mirror of
https://github.com/serde-rs/serde.git
synced 2025-09-28 13:30:48 +00:00

warning: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> test_suite/tests/regression/issue2844.rs:18:28 | 18 | pub fn serialize<S>(_: &i32, _: S) -> Result<S::Ok, S::Error> | ^^^^ help: consider passing by value instead: `i32` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref = note: `-W clippy::trivially-copy-pass-by-ref` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::trivially_copy_pass_by_ref)]`
34 lines
650 B
Rust
34 lines
650 B
Rust
#![allow(clippy::trivially_copy_pass_by_ref)]
|
|
|
|
use serde_derive::{Deserialize, Serialize};
|
|
|
|
macro_rules! declare_in_macro {
|
|
($with:literal) => {
|
|
#[derive(Serialize, Deserialize)]
|
|
pub struct S {
|
|
#[serde(with = $with)]
|
|
f: i32,
|
|
}
|
|
};
|
|
}
|
|
|
|
declare_in_macro!("with");
|
|
|
|
mod with {
|
|
use serde::{Deserializer, Serializer};
|
|
|
|
pub fn serialize<S>(_: &i32, _: S) -> Result<S::Ok, S::Error>
|
|
where
|
|
S: Serializer,
|
|
{
|
|
unimplemented!()
|
|
}
|
|
|
|
pub fn deserialize<'de, D>(_: D) -> Result<i32, D::Error>
|
|
where
|
|
D: Deserializer<'de>,
|
|
{
|
|
unimplemented!()
|
|
}
|
|
}
|