diff options
author | Bastian Kersting <bkersting@google.com> | 2024-01-19 09:17:14 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-01-22 15:08:01 +0000 |
commit | 8a15d25d79909cddb9b471779d6aecb12378d214 (patch) | |
tree | 867f38d043d3e6351df69333790eeeed862f3c5b | |
parent | ce17547322d2b2a7d571f393d300344938019206 (diff) | |
download | toolchain-utils-8a15d25d79909cddb9b471779d6aecb12378d214.tar.gz |
toolchain-utils: Fix clippy warnings for wrapper
BUG=None
TEST=CQ
Change-Id: I0c203c05bd39ce6e8f508af311ef10c9db1af8ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5214370
Reviewed-by: George Burgess <gbiv@chromium.org>
Tested-by: Bastian Kersting <bkersting@google.com>
Commit-Queue: Bastian Kersting <bkersting@google.com>
-rw-r--r-- | rust-analyzer-chromiumos-wrapper/src/main.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/rust-analyzer-chromiumos-wrapper/src/main.rs b/rust-analyzer-chromiumos-wrapper/src/main.rs index b03c01b0..1a1460d3 100644 --- a/rust-analyzer-chromiumos-wrapper/src/main.rs +++ b/rust-analyzer-chromiumos-wrapper/src/main.rs @@ -32,7 +32,7 @@ fn main() -> Result<()> { None => { // It doesn't appear that we're in a chroot. Run the // regular rust-analyzer. - return Err(process::Command::new("rust-analyzer").args(args).exec())?; + bail!(process::Command::new("rust-analyzer").args(args).exec()); } }; @@ -43,21 +43,23 @@ fn main() -> Result<()> { // * We don't support the arguments, so we bail. // * We still need to do our path translation in the LSP protocol. fn run(args: &[String]) -> Result<()> { - return Err(process::Command::new("cros_sdk") + bail!(process::Command::new("cros_sdk") .args(["--", "rust-analyzer"]) .args(args) - .exec())?; + .exec()); } - if args.iter().any(|x| match x.as_str() { - "--version" | "--help" | "-h" | "--print-config-schema" => true, - _ => false, + if args.iter().any(|x| { + matches!( + x.as_str(), + "--version" | "--help" | "-h" | "--print-config-schema" + ) }) { // With any of these options rust-analyzer will just print something and exit. return run(&args); } - if !args[0].starts_with("-") { + if !args[0].starts_with('-') { // It's a subcommand, and seemingly none of these need the path translation // rust-analyzer-chromiumos-wrapper provides. return run(&args); @@ -239,7 +241,7 @@ fn stream_with_replacement<R: BufRead, W: Write>( let mut buf2 = Vec::with_capacity(1024); loop { read_header(r, &mut head)?; - if head.length.is_none() && head.other_fields.len() == 0 { + if head.length.is_none() && head.other_fields.is_empty() { // No content in the header means we're apparently done. return Ok(()); } |