diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2021-02-16 23:33:20 -0500 |
|---|---|---|
| committer | Caleb Cartwright <calebcartwright@users.noreply.github.com> | 2021-02-18 20:20:29 -0600 |
| commit | c3a51111061e65a08ebce05c42e0d89ee1fae83a (patch) | |
| tree | 1153d11aba663fefe1f21ba3a44702c12fc5fff0 /src | |
| parent | 432e09e89f7e30fd418b43b1473b87c146d90674 (diff) | |
| download | rust-c3a51111061e65a08ebce05c42e0d89ee1fae83a.tar.gz rust-c3a51111061e65a08ebce05c42e0d89ee1fae83a.zip | |
Fix some clippy warnings
This commit can be replicated with `cargo clippy --fix -Z unstable-options && cargo +nightly-2021-02-10 fmt`.
Diffstat (limited to 'src')
| -rw-r--r-- | src/bin/main.rs | 8 | ||||
| -rw-r--r-- | src/cargo-fmt/main.rs | 2 | ||||
| -rw-r--r-- | src/format-diff/main.rs | 3 | ||||
| -rw-r--r-- | src/git-rustfmt/main.rs | 1 |
4 files changed, 5 insertions, 9 deletions
diff --git a/src/bin/main.rs b/src/bin/main.rs index 9101c015fb9..56b07222212 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -1,5 +1,5 @@ use anyhow::{format_err, Result}; -use env_logger; + use io::Error as IoError; use thiserror::Error; @@ -233,7 +233,7 @@ fn execute(opts: &Options) -> Result<i32> { let file = PathBuf::from(path); let file = file.canonicalize().unwrap_or(file); - let (config, _) = load_config(Some(file.parent().unwrap()), Some(options.clone()))?; + let (config, _) = load_config(Some(file.parent().unwrap()), Some(options))?; let toml = config.all_options().to_toml()?; io::stdout().write_all(toml.as_bytes())?; @@ -565,7 +565,7 @@ impl GetOptsOptions { options.inline_config = matches .opt_strs("config") .iter() - .flat_map(|config| config.split(",")) + .flat_map(|config| config.split(',')) .map( |key_val| match key_val.char_indices().find(|(_, ch)| *ch == '=') { Some((middle, _)) => { @@ -681,7 +681,7 @@ impl CliOptions for GetOptsOptions { } fn config_path(&self) -> Option<&Path> { - self.config_path.as_ref().map(|p| &**p) + self.config_path.as_deref() } } diff --git a/src/cargo-fmt/main.rs b/src/cargo-fmt/main.rs index 22aeceeb53b..9062a2952ec 100644 --- a/src/cargo-fmt/main.rs +++ b/src/cargo-fmt/main.rs @@ -2,8 +2,6 @@ #![deny(warnings)] -use cargo_metadata; - use std::cmp::Ordering; use std::collections::{BTreeMap, BTreeSet}; use std::env; diff --git a/src/format-diff/main.rs b/src/format-diff/main.rs index 8a8bb9356ca..c751932273b 100644 --- a/src/format-diff/main.rs +++ b/src/format-diff/main.rs @@ -4,10 +4,9 @@ #![deny(warnings)] -use env_logger; #[macro_use] extern crate log; -use regex; + use serde::{Deserialize, Serialize}; use serde_json as json; use thiserror::Error; diff --git a/src/git-rustfmt/main.rs b/src/git-rustfmt/main.rs index 936055e7722..16f5d1dd4f2 100644 --- a/src/git-rustfmt/main.rs +++ b/src/git-rustfmt/main.rs @@ -7,7 +7,6 @@ use std::path::{Path, PathBuf}; use std::process::Command; use std::str::FromStr; -use env_logger; use getopts::{Matches, Options}; use rustfmt_nightly as rustfmt; |
