From 608973c49826b59d757cb14da7e5cbfa94a149fe Mon Sep 17 00:00:00 2001 From: Gary Yu Date: Mon, 11 Mar 2019 11:13:42 +0800 Subject: [PATCH] Fix the build warning of deprecated trim_right_matches (#2662) --- api/src/handlers/peers_api.rs | 2 +- core/src/core.rs | 4 ++-- wallet/src/controller.rs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/src/handlers/peers_api.rs b/api/src/handlers/peers_api.rs index 6453432fb..639b2927e 100644 --- a/api/src/handlers/peers_api.rs +++ b/api/src/handlers/peers_api.rs @@ -79,7 +79,7 @@ impl Handler for PeerHandler { } } fn post(&self, req: Request) -> ResponseFuture { - let mut path_elems = req.uri().path().trim_right_matches('/').rsplit('/'); + let mut path_elems = req.uri().path().trim_end_matches('/').rsplit('/'); let command = match path_elems.next() { None => return response(StatusCode::BAD_REQUEST, "invalid url"), Some(c) => c, diff --git a/core/src/core.rs b/core/src/core.rs index d761bb751..009236ea6 100644 --- a/core/src/core.rs +++ b/core/src/core.rs @@ -95,9 +95,9 @@ pub fn amount_to_hr_string(amount: u64, truncate: bool) -> String { if truncate { let nzeros = hr.chars().rev().take_while(|x| x == &'0').count(); if nzeros < *WIDTH { - return hr.trim_right_matches('0').to_string(); + return hr.trim_end_matches('0').to_string(); } else { - return format!("{}0", hr.trim_right_matches('0')); + return format!("{}0", hr.trim_end_matches('0')); } } hr diff --git a/wallet/src/controller.rs b/wallet/src/controller.rs index 89dc1cb8b..f69a02dd1 100644 --- a/wallet/src/controller.rs +++ b/wallet/src/controller.rs @@ -300,7 +300,7 @@ where match req .uri() .path() - .trim_right_matches("/") + .trim_end_matches("/") .rsplit("/") .next() .unwrap() @@ -553,7 +553,7 @@ where match req .uri() .path() - .trim_right_matches("/") + .trim_end_matches("/") .rsplit("/") .next() .unwrap() @@ -684,7 +684,7 @@ where match req .uri() .path() - .trim_right_matches("/") + .trim_end_matches("/") .rsplit("/") .next() .unwrap()