Borrow instead of clone

This commit is contained in:
Vladimir Borisov 2021-07-27 18:07:57 +03:00
parent 7a4bece1b9
commit 9b68795d63
No known key found for this signature in database
GPG key ID: F9A584BE4FCB6603

View file

@ -22,10 +22,10 @@ impl RPCRequest {
.and_then(|args| args.first())
.and_then(|arg| arg.as_str())
}
pub fn get_params(&self) -> Option<serde_json::Value> {
pub fn get_params(&self) -> Option<&serde_json::Value> {
self.args.as_ref().and_then(|args| {
if args.len() > 1 {
Some(args[1].clone())
Some(&args[1])
} else {
None
}