phil
ef72b2cac0
Check {print,write}_with_newline for literal newline
...
Both regular strings and raw strings can contain literal newlines. This commit
extends the lint to also warn about terminating strings with these.
Behaviour handling for raw strings is also moved into `check_newlines` by
passing in the `is_raw` boolean from `check_tts` as
[suggested](https://github.com/rust-lang/rust-clippy/pull/3781#pullrequestreview-204663732 )
2019-02-18 19:22:20 -05:00
phil
3fa3bd8e94
Don't fail for raw string ending in \n
...
Pass tests for #3778 , {print,write}_with_newline false positive
This change guards the lint from checking newlines with a sort of complicated
check to see if it's a raw string. Raw strings shouldn't be newline-checked,
since r"\n" is literally \-n, not a newline. I think it's ok not to check for
_literal_ newlines at the end of raw strings, but maybe that's debatable.
I... don't think this code is that great. I wanted to write the check after
`check_tts`, but that was too late -- raw string type info is lost (or I
couldn't find it). Putting it inside `check_tts` feels heavy-duty and the check
itself feels like a brittle reach possibly into places it shouldn't.
Maybe someone can fix this up :)
2019-02-18 11:39:40 -05:00
Matthias Krüger
e9e0a7e3bd
rustup https://github.com/rust-lang/rust/pull/57726
2019-01-27 01:42:34 +01:00
Michael Wright
77b71a1af2
Fix breakage due to rust-lang/rust#57755
2019-01-20 10:14:23 +02:00
Philipp Hansch
38d4ac7cea
Remove all copyright license headers
...
Discussion previously happened in https://github.com/rust-lang/rust/pull/43498
2019-01-08 21:46:39 +01:00
Konrad Borowski
3f62fc3a7e
Remove crate:: prefixes from crate paths
...
This is somewhat misleading, as those are actually external crates,
and don't need a crate:: prefix.
2018-12-29 16:05:49 +01:00
Matthias Krüger
99454bc9a1
rustup https://github.com/rust-lang/rust/pull/57069
2018-12-27 11:19:20 +01:00
Matthias Krüger
7f5e17f3f1
fix a couple of ftrivial typos (NFC).
2018-12-25 18:22:34 +01:00
Michael Wright
c6505aa160
Fix write_with_newline escaping false positive
...
Fixes #3514
2018-12-11 08:44:49 +02:00
flip1995
1751d2496d
Run rustfmt on clippy_lints
2018-11-27 21:14:15 +01:00
flip1995
6eb8e6d7c5
Fix dogfood error
2018-11-27 16:59:52 +01:00
flip1995
4e74eef6e9
Add applicability level to (nearly) every span_lint_and_sugg function
2018-11-27 15:29:23 +01:00
flip1995
3740da203b
Fix bugs and improve documentation
...
Some bugs and some documentation is unrelated to the Applicability change, but
these bugs were serious and the documentation was kind of required to
understand what's going on.
2018-11-27 15:29:23 +01:00
flip1995
9096269610
Add Applicability::Unspecified to span_lint_and_sugg functions
2018-11-27 15:29:23 +01:00
Philipp Hansch
41e94dd072
Merge pull request #3285 from devonhollowood/pedantic-dogfood-items-after-statements
...
Pedantic dogfood: `items_after_statements`
2018-10-08 06:59:55 +01:00
Devon Hollowood
82638e4dd4
Fix items_after_statements for const
s
2018-10-07 17:09:32 -07:00
Devon Hollowood
6528749083
Fix items_after_statements for use
statements
2018-10-07 17:09:32 -07:00
Manish Goregaokar
e9c025ea70
Add license header to Rust files
2018-10-06 09:43:08 -07:00
Eduard-Mihai Burtescu
9219fc6c5c
Reintroduce extern crate
for non-Cargo dependencies.
2018-09-15 11:10:51 +03:00
flip1995
fa3e3cb6ea
Fix #3145 by removing assert
2018-09-07 17:18:00 +02:00
Matthias Krüger
a0f56edfc3
print_with_newline / write_with_newline: don't warn about string with several \n
s in them.
...
Fixes #3126
2018-09-06 12:59:34 +02:00
Matthias Krüger
0a8ceaf8b0
rustfmt clippy_lints/src/write.rs
2018-09-06 12:33:00 +02:00
flip1995
8c07772dbb
Switch to declare_tool_lint macro
2018-08-29 11:08:29 -07:00
Oliver Schneider
d99cea0f16
Update imports and rustup
2018-08-28 13:13:42 +02:00
Lachezar Lechev
76f7bfcefd
#3016 Add backticks for the msg
2018-08-20 15:50:15 +02:00
Lachezar Lechev
c292b80783
#3016 Add feedback and implement test for fixed hardcoded suggestion
2018-08-20 15:33:43 +02:00
Lachezar Lechev
3015987f27
#3016 [WIP] Implement feedback and suggestions
2018-08-20 14:03:13 +02:00
Lachezar Lechev
6cb94630fb
WIP of #3016 for hardocded suggestion for writeln on empty string
2018-08-16 18:20:06 +02:00
Philipp Krones
b2a4013c14
Merge pull request #3014 from estk/allow-write-multi-newline
...
Allow print/write with multiple newlines
2018-08-14 12:54:05 +02:00
Matthias Krüger
88d693918f
docs: add more suggestions on how to fix clippy findings to the online lint list.
2018-08-12 11:29:44 +02:00
Evan Simmons
550ff84ecd
Allow print/write with multiple newlines
2018-08-07 12:01:10 -08:00
Scott McMurray
73e097e9f1
Fix the build after https://github.com/rust-lang/rust/pull/53016
...
In-band lifetimes are no longer in the edition, so update the one place that was using them.
2018-08-07 00:05:09 -07:00
Thomas Gideon
bf3f976a43
Fix regression in print_literal
2018-07-25 17:31:17 -04:00
Oliver Schneider
afd91248ed
Rustup
2018-07-23 13:01:12 +02:00
Oliver Schneider
ff0e5f967f
Rewrite the print/write macro checks as a PreExpansionPass
2018-07-23 00:19:07 +02:00
Manish Goregaokar
5918a3fc1e
Remove import of if_chain
2018-07-20 00:50:02 -07:00
Manish Goregaokar
5d74e2096b
Remove import of rustc
2018-07-19 00:53:23 -07:00
Oliver Schneider
6992937002
Update for hir renamings in rustc
2018-07-16 15:07:39 +02:00
csmoe
1bd17e4fa2
ExprKind
2018-07-16 11:46:37 +02:00
Mateusz Mikuła
48cb6e273e
Rustup
2018-06-29 09:49:05 +02:00
Oliver Schneider
bb2f6a5011
Merge pull request #2821 from mati865/rust-2018-migration
...
Rust 2018 migration
2018-05-30 15:55:11 +02:00
Mateusz Mikuła
424a33720d
Run rustfix
2018-05-30 10:15:50 +02:00
Oliver Schneider
ce229b2025
Version bump
2018-05-29 11:58:58 +02:00
Mateusz Mikuła
8ed8ee895a
Update to nightly 2018-05-28
2018-05-29 10:56:58 +02:00
Philipp Hansch
1712e18b77
Rustup to latest nightly
...
Due to https://github.com/rust-lang/rust/pull/48995 and
https://github.com/rust-lang/rust/pull/49894
2018-04-28 12:56:31 +02:00
Michael Recachinas
54c0edcfe8
Add smaller check_unformatted to write.rs and fix precision,width,align false positive
2018-04-21 19:51:58 +01:00
MSI\Stew's Laptop
d175c797e5
fixing error message for empty println macro
2018-04-15 14:00:28 +02:00
Evan Simmons
d712991917
New lints for write! / writeln! macros.
2018-04-07 22:45:26 -07:00