Skip to content

Commit d3d14df

Browse files
committed
Revert "Dogfood missing_assert_message on Clippy"
This reverts commit ec65357.
1 parent fe280e3 commit d3d14df

File tree

13 files changed

+19
-35
lines changed

13 files changed

+19
-35
lines changed

clippy_lints/src/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ pub fn strip_doc_comment_decoration(doc: &str, comment_kind: CommentKind, span:
462462
let mut contains_initial_stars = false;
463463
for line in doc.lines() {
464464
let offset = line.as_ptr() as usize - doc.as_ptr() as usize;
465-
debug_assert_eq!(offset as u32 as usize, offset, "`offset` shouldn't overflow `u32`");
465+
debug_assert_eq!(offset as u32 as usize, offset);
466466
contains_initial_stars |= line.trim_start().starts_with('*');
467467
// +1 adds the newline, +3 skips the opening delimiter
468468
sizes.push((line.len() + 1, span.with_lo(span.lo() + BytePos(3 + offset as u32))));

clippy_lints/src/duplicate_mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,7 @@ impl EarlyLintPass for DuplicateMod {
9090
}
9191

9292
// At this point the lint would be emitted
93-
assert_eq!(
94-
spans.len(),
95-
lint_levels.len(),
96-
"`spans` and `lint_levels` should have equal lengths"
97-
);
93+
assert_eq!(spans.len(), lint_levels.len());
9894
let spans: Vec<_> = spans
9995
.iter()
10096
.zip(lint_levels)

clippy_lints/src/enum_variants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ fn to_camel_case(item_name: &str) -> String {
242242
impl LateLintPass<'_> for EnumVariantNames {
243243
fn check_item_post(&mut self, _cx: &LateContext<'_>, _item: &Item<'_>) {
244244
let last = self.modules.pop();
245-
assert!(last.is_some(), "`modules` should not be empty");
245+
assert!(last.is_some());
246246
}
247247

248248
#[expect(clippy::similar_names)]

clippy_lints/src/non_expressive_names.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,10 +408,7 @@ fn do_check(lint: &mut NonExpressiveNames, cx: &EarlyContext<'_>, attrs: &[Attri
408408
/// Precondition: `a_name.chars().count() < b_name.chars().count()`.
409409
#[must_use]
410410
fn levenstein_not_1(a_name: &str, b_name: &str) -> bool {
411-
debug_assert!(
412-
a_name.chars().count() < b_name.chars().count(),
413-
"Precondition: `a_name.chars().count() < b_name.chars().count()` does not meet"
414-
);
411+
debug_assert!(a_name.chars().count() < b_name.chars().count());
415412
let mut a_chars = a_name.chars();
416413
let mut b_chars = b_name.chars();
417414
while let (Some(a), Some(b)) = (a_chars.next(), b_chars.next()) {

clippy_utils/src/attrs.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub struct LimitStack {
3131

3232
impl Drop for LimitStack {
3333
fn drop(&mut self) {
34-
assert_eq!(self.stack.len(), 1, "stack should only have one element");
34+
assert_eq!(self.stack.len(), 1);
3535
}
3636
}
3737

@@ -49,9 +49,7 @@ impl LimitStack {
4949
}
5050
pub fn pop_attrs(&mut self, sess: &Session, attrs: &[ast::Attribute], name: &'static str) {
5151
let stack = &mut self.stack;
52-
parse_attrs(sess, attrs, name, |val| {
53-
assert_eq!(stack.pop(), Some(val), "incorrect last element");
54-
});
52+
parse_attrs(sess, attrs, name, |val| assert_eq!(stack.pop(), Some(val)));
5553
}
5654
}
5755

clippy_utils/src/lib.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,13 +1011,10 @@ pub fn capture_local_usage(cx: &LateContext<'_>, e: &Expr<'_>) -> CaptureKind {
10111011
capture
10121012
}
10131013

1014-
debug_assert!(
1015-
matches!(
1016-
e.kind,
1017-
ExprKind::Path(QPath::Resolved(None, Path { res: Res::Local(_), .. }))
1018-
),
1019-
"`e.kind` should be a resolved local path"
1020-
);
1014+
debug_assert!(matches!(
1015+
e.kind,
1016+
ExprKind::Path(QPath::Resolved(None, Path { res: Res::Local(_), .. }))
1017+
));
10211018

10221019
let mut child_id = e.hir_id;
10231020
let mut capture = CaptureKind::Value;

clippy_utils/src/numeric_literal.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl<'a> NumericLiteral<'a> {
179179
}
180180

181181
pub fn group_digits(output: &mut String, input: &str, group_size: usize, partial_group_first: bool, pad: bool) {
182-
debug_assert!(group_size > 0, "group size should be greater than zero");
182+
debug_assert!(group_size > 0);
183183

184184
let mut digits = input.chars().filter(|&c| c != '_');
185185

@@ -219,7 +219,7 @@ impl<'a> NumericLiteral<'a> {
219219
}
220220

221221
fn split_suffix<'a>(src: &'a str, lit_kind: &LitKind) -> (&'a str, Option<&'a str>) {
222-
debug_assert!(lit_kind.is_numeric(), "`lit_kind` should be numeric");
222+
debug_assert!(lit_kind.is_numeric());
223223
lit_suffix_length(lit_kind)
224224
.and_then(|suffix_length| src.len().checked_sub(suffix_length))
225225
.map_or((src, None), |split_pos| {
@@ -229,7 +229,7 @@ fn split_suffix<'a>(src: &'a str, lit_kind: &LitKind) -> (&'a str, Option<&'a st
229229
}
230230

231231
fn lit_suffix_length(lit_kind: &LitKind) -> Option<usize> {
232-
debug_assert!(lit_kind.is_numeric(), "`lit_kind` should be numeric");
232+
debug_assert!(lit_kind.is_numeric());
233233
let suffix = match lit_kind {
234234
LitKind::Int(_, int_lit_kind) => match int_lit_kind {
235235
LitIntType::Signed(int_ty) => Some(int_ty.name_str()),

clippy_utils/src/ty.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ pub fn implements_trait_with_env<'tcx>(
225225
trait_id: DefId,
226226
ty_params: impl IntoIterator<Item = Option<GenericArg<'tcx>>>,
227227
) -> bool {
228-
assert!(!ty.needs_infer(), "Clippy shouldn't have infer types");
228+
// Clippy shouldn't have infer types
229+
assert!(!ty.needs_infer());
229230

230231
let ty = tcx.erase_regions(ty);
231232
if ty.has_escaping_bound_vars() {

lintcheck/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ impl Crate {
383383
.status()
384384
.expect("failed to run cargo");
385385

386-
assert_eq!(status.code(), Some(0), "`cargo check` exited with non-zero code");
386+
assert_eq!(status.code(), Some(0));
387387

388388
return Vec::new();
389389
}
@@ -741,7 +741,6 @@ fn print_stats(old_stats: HashMap<String, usize>, new_stats: HashMap<&String, us
741741
let mut new_stats_deduped = new_stats;
742742

743743
// remove duplicates from both hashmaps
744-
#[allow(clippy::missing_assert_message)]
745744
for (k, v) in &same_in_both_hashmaps {
746745
assert!(old_stats_deduped.remove(k) == Some(*v));
747746
assert!(new_stats_deduped.remove(k) == Some(*v));

tests/compile-test.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,7 @@ fn check_rustfix_coverage() {
410410
};
411411

412412
if let Ok(missing_coverage_contents) = std::fs::read_to_string(missing_coverage_path) {
413-
assert!(
414-
RUSTFIX_COVERAGE_KNOWN_EXCEPTIONS.iter().is_sorted_by_key(Path::new),
415-
"`RUSTFIX_COVERAGE_KNOWN_EXCEPTIONS` should be sorted"
416-
);
413+
assert!(RUSTFIX_COVERAGE_KNOWN_EXCEPTIONS.iter().is_sorted_by_key(Path::new));
417414

418415
for rs_file in missing_coverage_contents.lines() {
419416
let rs_path = Path::new(rs_file);

0 commit comments

Comments
 (0)