]> git.lizzy.rs Git - rust.git/commitdiff
Pass in char instead of single-char string
authorkjeremy <kjeremy@gmail.com>
Fri, 26 Apr 2019 15:41:58 +0000 (11:41 -0400)
committerkjeremy <kjeremy@gmail.com>
Fri, 26 Apr 2019 15:41:58 +0000 (11:41 -0400)
crates/ra_prof/src/lib.rs

index 402c719b153462d1d4ec48e0c3c998fffba11ddb..ba432912f386f6de8e438d4477c1672dc1ef83bf 100644 (file)
@@ -107,7 +107,7 @@ impl Filter {
     // env RA_PROFILE=foo|bar|baz   // enabled only selected entries
     // env RA_PROFILE=*@3>10        // dump everything, up to depth 3, if it takes more than 10 ms
     pub fn from_spec(mut spec: &str) -> Filter {
-        let longer_than = if let Some(idx) = spec.rfind(">") {
+        let longer_than = if let Some(idx) = spec.rfind('>') {
             let longer_than = spec[idx + 1..].parse().expect("invalid profile longer_than");
             spec = &spec[..idx];
             Duration::from_millis(longer_than)
@@ -115,7 +115,7 @@ pub fn from_spec(mut spec: &str) -> Filter {
             Duration::new(0, 0)
         };
 
-        let depth = if let Some(idx) = spec.rfind("@") {
+        let depth = if let Some(idx) = spec.rfind('@') {
             let depth: usize = spec[idx + 1..].parse().expect("invalid profile depth");
             spec = &spec[..idx];
             depth
@@ -123,7 +123,7 @@ pub fn from_spec(mut spec: &str) -> Filter {
             999
         };
         let allowed =
-            if spec == "*" { Vec::new() } else { spec.split("|").map(String::from).collect() };
+            if spec == "*" { Vec::new() } else { spec.split('|').map(String::from).collect() };
         Filter::new(depth, allowed, longer_than)
     }