Skip to content

Commit 62407cd

Browse files
committed
Revert "Improved tools with clippy"
This reverts commit 828da47.
1 parent 828da47 commit 62407cd

File tree

8 files changed

+21
-18
lines changed

8 files changed

+21
-18
lines changed

src/tools/build_helper/src/ci.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl CiEnv {
3030
// The explicit `TERM=xterm` environment is needed for
3131
// `--color always` to actually work. This env var was lost when
3232
// compiling through the Makefile. Very strange.
33-
cmd.env("TERM", "xterm").args(["--color", "always"]);
33+
cmd.env("TERM", "xterm").args(&["--color", "always"]);
3434
}
3535
}
3636
}

src/tools/build_helper/src/git.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn output_result(cmd: &mut Command) -> Result<String, String> {
2121
String::from_utf8(output.stderr).map_err(|err| format!("{err:?}"))?
2222
));
2323
}
24-
String::from_utf8(output.stdout).map_err(|err| format!("{err:?}"))
24+
Ok(String::from_utf8(output.stdout).map_err(|err| format!("{err:?}"))?)
2525
}
2626

2727
/// Finds the remote for rust-lang/rust.

src/tools/clippy/declare_clippy_lint/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub fn declare_clippy_lint(input: TokenStream) -> TokenStream {
144144

145145
let info_name = format_ident!("{name}_INFO");
146146

147-
category[0..1].make_ascii_uppercase();
147+
(&mut category[0..1]).make_ascii_uppercase();
148148
let category_variant = format_ident!("{category}");
149149

150150
let output = quote! {

src/tools/miropt-test-tools/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub fn files_for_miropt_test(
5151
panic_strategy: PanicStrategy,
5252
) -> MiroptTest {
5353
let mut out = Vec::new();
54-
let test_file_contents = fs::read_to_string(testfile).unwrap();
54+
let test_file_contents = fs::read_to_string(&testfile).unwrap();
5555

5656
let test_dir = testfile.parent().unwrap();
5757
let test_crate = testfile.file_stem().unwrap().to_str().unwrap().replace('-', "_");

src/tools/rustfmt/build.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ fn channel() -> String {
4040

4141
fn commit_hash() -> Option<String> {
4242
Command::new("git")
43-
.args(["rev-parse", "--short", "HEAD"])
43+
.args(&["rev-parse", "--short", "HEAD"])
4444
.output()
4545
.ok()
4646
.and_then(|r| String::from_utf8(r.stdout).ok())
4747
}
4848

4949
fn commit_date() -> Option<String> {
5050
Command::new("git")
51-
.args(["log", "-1", "--date=short", "--pretty=format:%cd"])
51+
.args(&["log", "-1", "--date=short", "--pretty=format:%cd"])
5252
.output()
5353
.ok()
5454
.and_then(|r| String::from_utf8(r.stdout).ok())

src/tools/rustfmt/config_proc_macro/src/attrs.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,24 @@ pub fn is_unstable_variant(attr: &syn::Attribute) -> bool {
5151
}
5252

5353
fn is_attr_name_value(attr: &syn::Attribute, name: &str) -> bool {
54-
matches!(&attr.meta,
55-
syn::Meta::NameValue(syn::MetaNameValue { path, .. }) if path.is_ident(name))
54+
match &attr.meta {
55+
syn::Meta::NameValue(syn::MetaNameValue { path, .. }) if path.is_ident(name) => true,
56+
_ => false,
57+
}
5658
}
5759

5860
fn is_attr_path(attr: &syn::Attribute, name: &str) -> bool {
59-
matches!(&attr.meta,
60-
syn::Meta::Path(path) if path.is_ident(name))
61+
match &attr.meta {
62+
syn::Meta::Path(path) if path.is_ident(name) => true,
63+
_ => false,
64+
}
6165
}
6266

6367
fn get_name_value_str_lit(attr: &syn::Attribute, name: &str) -> Option<String> {
6468
match &attr.meta {
6569
syn::Meta::NameValue(syn::MetaNameValue {
6670
path,
67-
value:
68-
syn::Expr::Lit(syn::ExprLit {
69-
lit: syn::Lit::Str(lit_str),
70-
..
71-
}),
71+
value: syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(lit_str), .. }),
7272
..
7373
}) if path.is_ident(name) => Some(lit_str.value()),
7474
_ => None,

src/tools/rustfmt/config_proc_macro/src/item_enum.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fn impl_doc_hint(ident: &syn::Ident, variants: &Variants) -> TokenStream {
7575

7676
let variant_stables = variants
7777
.iter()
78-
.map(|v| (&v.ident, fields_in_variant(v), !unstable_of_variant(v)));
78+
.map(|v| (&v.ident, fields_in_variant(&v), !unstable_of_variant(v)));
7979
let match_patterns = fold_quote(variant_stables, |(v, fields, stable)| {
8080
quote! {
8181
#ident::#v #fields => #stable,
@@ -150,7 +150,7 @@ fn impl_from_str(ident: &syn::Ident, variants: &Variants) -> TokenStream {
150150

151151
fn doc_hint_of_variant(variant: &syn::Variant) -> String {
152152
let mut text = find_doc_hint(&variant.attrs).unwrap_or(variant.ident.to_string());
153-
if unstable_of_variant(variant) {
153+
if unstable_of_variant(&variant) {
154154
text.push_str(" (unstable)")
155155
};
156156
text

src/tools/rustfmt/config_proc_macro/src/utils.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ where
1313
}
1414

1515
pub fn is_unit(v: &syn::Variant) -> bool {
16-
v.fields == syn::Fields::Unit
16+
match v.fields {
17+
syn::Fields::Unit => true,
18+
_ => false,
19+
}
1720
}
1821

1922
#[cfg(feature = "debug-with-rustfmt")]

0 commit comments

Comments
 (0)