mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Pass in char instead of single-char string
This commit is contained in:
parent
70dc33e00c
commit
47f10fce8a
1 changed files with 3 additions and 3 deletions
|
@ -107,7 +107,7 @@ impl Filter {
|
||||||
// env RA_PROFILE=foo|bar|baz // enabled only selected entries
|
// 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
|
// 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 {
|
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");
|
let longer_than = spec[idx + 1..].parse().expect("invalid profile longer_than");
|
||||||
spec = &spec[..idx];
|
spec = &spec[..idx];
|
||||||
Duration::from_millis(longer_than)
|
Duration::from_millis(longer_than)
|
||||||
|
@ -115,7 +115,7 @@ impl Filter {
|
||||||
Duration::new(0, 0)
|
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");
|
let depth: usize = spec[idx + 1..].parse().expect("invalid profile depth");
|
||||||
spec = &spec[..idx];
|
spec = &spec[..idx];
|
||||||
depth
|
depth
|
||||||
|
@ -123,7 +123,7 @@ impl Filter {
|
||||||
999
|
999
|
||||||
};
|
};
|
||||||
let allowed =
|
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)
|
Filter::new(depth, allowed, longer_than)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue