Skip to content

Commit 83294f8

Browse files
committed
Some small fixes
1 parent 5b484b4 commit 83294f8

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

clippy_lints/src/write.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,8 @@ impl EarlyLintPass for Write {
235235
}
236236

237237
fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &MacCall) {
238-
fn is_build_scripts(cx: &EarlyContext<'_>) -> bool {
239-
// We could leverage the fact that Cargo sets the crate name
240-
// for build scripts to `build_script_build`.
238+
fn is_build_script(cx: &EarlyContext<'_>) -> bool {
239+
// Cargo sets the crate name for build scripts to `build_script_build`
241240
cx.sess
242241
.opts
243242
.crate_name
@@ -246,7 +245,7 @@ impl EarlyLintPass for Write {
246245
}
247246

248247
if mac.path == sym!(println) {
249-
if !is_build_scripts(cx) {
248+
if !is_build_script(cx) {
250249
span_lint(cx, PRINT_STDOUT, mac.span(), "use of `println!`");
251250
}
252251
if let (Some(fmt_str), _) = self.check_tts(cx, mac.args.inner_tokens(), false) {
@@ -263,7 +262,7 @@ impl EarlyLintPass for Write {
263262
}
264263
}
265264
} else if mac.path == sym!(print) {
266-
if !is_build_scripts(cx) {
265+
if !is_build_script(cx) {
267266
span_lint(cx, PRINT_STDOUT, mac.span(), "use of `print!`");
268267
}
269268
if let (Some(fmt_str), _) = self.check_tts(cx, mac.args.inner_tokens(), false) {

tests/ui/print_stdout_build_script.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
fn main() {
66
// Fix #6041
77
//
8-
// The `print_stdout` shouldn't be linted in `build.rs`
8+
// The `print_stdout` lint shouldn't emit in `build.rs`
99
// as these methods are used for the build script.
1010
println!("Hello");
1111
print!("Hello");

tests/ui/print_stdout_build_script.stderr

Whitespace-only changes.

0 commit comments

Comments
 (0)