Skip to content

Commit e62c1c9

Browse files
committed
apply case_lossless to Clippy source
1 parent fc4254b commit e62c1c9

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

clippy_lints/src/booleans.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ impl SuggestContext<'_, '_, '_> {
345345
self.output.push(')');
346346
},
347347
Term(n) => {
348-
let terminal = self.terminals[n as usize];
348+
let terminal = self.terminals[usize::from(n)];
349349
if let Some(str) = simplify_not(self.cx, self.msrv, terminal) {
350350
self.output.push_str(&str);
351351
} else {
@@ -387,7 +387,7 @@ impl SuggestContext<'_, '_, '_> {
387387
},
388388
&Term(n) => {
389389
self.output.push_str(
390-
&self.terminals[n as usize]
390+
&self.terminals[usize::from(n)]
391391
.span
392392
.source_callsite()
393393
.get_source_text(self.cx)?,
@@ -528,7 +528,7 @@ fn terminal_stats(b: &Bool) -> Stats {
528528
recurse(inner, stats);
529529
}
530530
},
531-
&Term(n) => stats.terminals[n as usize] += 1,
531+
&Term(n) => stats.terminals[usize::from(n)] += 1,
532532
}
533533
}
534534
use quine_mc_cluskey::Bool::{And, False, Not, Or, Term, True};

clippy_lints/src/literal_string_with_formatting_args.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl<'tcx> LateLintPass<'tcx> for LiteralStringWithFormattingArg {
9090
LitKind::Str(symbol, style) => {
9191
let add = match style {
9292
StrStyle::Cooked => 1,
93-
StrStyle::Raw(nb) => nb as usize + 2,
93+
StrStyle::Raw(nb) => usize::from(nb) + 2,
9494
};
9595
(add, symbol)
9696
},

clippy_lints/src/regex.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ fn lint_syntax_error(cx: &LateContext<'_>, error: &regex_syntax::Error, unescape
197197

198198
if let Some((primary, auxiliary, kind)) = parts
199199
&& let Some(literal_snippet) = base.get_source_text(cx)
200-
&& let Some(inner) = literal_snippet.get(offset as usize..)
200+
&& let Some(inner) = literal_snippet.get(usize::from(offset)..)
201201
// Only convert to native rustc spans if the parsed regex matches the
202202
// source snippet exactly, to ensure the span offsets are correct
203203
&& inner.get(..unescaped.len()) == Some(unescaped)

clippy_lints/src/unicode.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl LateLintPass<'_> for Unicode {
8787
fn escape<T: Iterator<Item = char>>(s: T) -> String {
8888
let mut result = String::new();
8989
for c in s {
90-
if c as u32 > 0x7F {
90+
if u32::from(c) > 0x7F {
9191
for d in c.escape_unicode() {
9292
result.push(d);
9393
}
@@ -119,7 +119,7 @@ fn check_str(cx: &LateContext<'_>, span: Span, id: HirId) {
119119
});
120120
}
121121

122-
if string.chars().any(|c| c as u32 > 0x7F) {
122+
if string.chars().any(|c| u32::from(c) > 0x7F) {
123123
#[expect(clippy::collapsible_span_lint_calls, reason = "rust-clippy#7797")]
124124
span_lint_and_then(
125125
cx,

clippy_utils/src/source.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ pub fn str_literal_to_char_literal(
713713
{
714714
let snip = snippet_with_applicability(sess, expr.span, string, applicability);
715715
let ch = if let StrStyle::Raw(nhash) = style {
716-
let nhash = nhash as usize;
716+
let nhash = usize::from(nhash);
717717
// for raw string: r##"a"##
718718
&snip[(nhash + 2)..(snip.len() - 1 - nhash)]
719719
} else {

0 commit comments

Comments
 (0)