Skip to content

Commit 7c2d57e

Browse files
committed
couple of clippy::complexity fixes
1 parent 0d13f6a commit 7c2d57e

File tree

16 files changed

+25
-29
lines changed

16 files changed

+25
-29
lines changed

compiler/rustc_errors/src/diagnostic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ impl Diagnostic {
832832
name: impl Into<Cow<'static, str>>,
833833
arg: DiagnosticArgValue<'static>,
834834
) -> &mut Self {
835-
self.args.push((name.into(), arg.into()));
835+
self.args.push((name.into(), arg));
836836
self
837837
}
838838

compiler/rustc_expand/src/mbe/macro_check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ fn check_binders(
270270
MISSING_FRAGMENT_SPECIFIER,
271271
span,
272272
node_id,
273-
&format!("missing fragment specifier"),
273+
"missing fragment specifier",
274274
);
275275
}
276276
if !macros.is_empty() {

compiler/rustc_infer/src/infer/at.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
6363
/// common state. Used in coherence.
6464
pub fn fork(&self) -> Self {
6565
Self {
66-
tcx: self.tcx.clone(),
67-
defining_use_anchor: self.defining_use_anchor.clone(),
68-
in_progress_typeck_results: self.in_progress_typeck_results.clone(),
66+
tcx: self.tcx,
67+
defining_use_anchor: self.defining_use_anchor,
68+
in_progress_typeck_results: self.in_progress_typeck_results,
6969
inner: self.inner.clone(),
7070
skip_leak_check: self.skip_leak_check.clone(),
7171
lexical_region_resolutions: self.lexical_region_resolutions.clone(),

compiler/rustc_macros/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn symbols(input: TokenStream) -> TokenStream {
4444
#[proc_macro]
4545
#[allow_internal_unstable(step_trait, rustc_attrs, trusted_step)]
4646
pub fn newtype_index(input: TokenStream) -> TokenStream {
47-
newtype::newtype(input).into()
47+
newtype::newtype(input)
4848
}
4949

5050
decl_derive!([HashStable, attributes(stable_hasher)] => hash_stable::hash_stable_derive);

compiler/rustc_middle/src/ty/inhabitedness/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl<'tcx> Ty<'tcx> {
191191
tcx: TyCtxt<'tcx>,
192192
param_env: ty::ParamEnv<'tcx>,
193193
) -> DefIdForest<'tcx> {
194-
tcx.type_uninhabited_from(param_env.and(self)).clone()
194+
tcx.type_uninhabited_from(param_env.and(self))
195195
}
196196
}
197197

compiler/rustc_mir_build/src/build/expr/as_constant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
3939
}
4040
};
4141

42-
Constant { span, user_ty: None, literal: literal.into() }
42+
Constant { span, user_ty: None, literal }
4343
}
4444
ExprKind::NonHirLiteral { lit, user_ty } => {
4545
let user_ty = user_ty.map(|user_ty| {

compiler/rustc_mir_build/src/build/expr/into.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
423423
}
424424
thir::InlineAsmOperand::Const { value, span } => {
425425
mir::InlineAsmOperand::Const {
426-
value: Box::new(Constant {
427-
span,
428-
user_ty: None,
429-
literal: value.into(),
430-
}),
426+
value: Box::new(Constant { span, user_ty: None, literal: value }),
431427
}
432428
}
433429
thir::InlineAsmOperand::SymFn { expr } => mir::InlineAsmOperand::SymFn {

compiler/rustc_mir_build/src/build/matches/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
441441
// Need to experiment.
442442
user_ty: None,
443443

444-
literal: method.into(),
444+
literal: method,
445445
})),
446446
args: vec![val, expect],
447447
destination: Some((eq_result, eq_block)),

compiler/rustc_mir_transform/src/check_unsafety.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,13 +539,13 @@ fn report_unused_unsafe(tcx: TyCtxt<'_>, kind: UnusedUnsafe, id: HirId) {
539539
UnusedUnsafe::InUnsafeBlock(id) => {
540540
db.span_label(
541541
tcx.sess.source_map().guess_head_span(tcx.hir().span(id)),
542-
format!("because it's nested under this `unsafe` block"),
542+
"because it's nested under this `unsafe` block",
543543
);
544544
}
545545
UnusedUnsafe::InUnsafeFn(id, usage_lint_root) => {
546546
db.span_label(
547547
tcx.sess.source_map().guess_head_span(tcx.hir().span(id)),
548-
format!("because it's nested under this `unsafe` fn"),
548+
"because it's nested under this `unsafe` fn",
549549
)
550550
.note(
551551
"this `unsafe` block does contain unsafe operations, \

compiler/rustc_parse/src/lexer/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,13 @@ impl<'a> StringReader<'a> {
234234
rustc_lexer::TokenKind::InvalidIdent
235235
// Do not recover an identifier with emoji if the codepoint is a confusable
236236
// with a recoverable substitution token, like `➖`.
237-
if UNICODE_ARRAY
237+
if !UNICODE_ARRAY
238238
.iter()
239-
.find(|&&(c, _, _)| {
239+
.any(|&(c, _, _)| {
240240
let sym = self.str_from(start);
241241
sym.chars().count() == 1 && c == sym.chars().next().unwrap()
242242
})
243-
.is_none() =>
243+
=>
244244
{
245245
let sym = nfc_normalize(self.str_from(start));
246246
let span = self.mk_sp(start, self.pos);

0 commit comments

Comments
 (0)