Skip to content

Commit 1ccef14

Browse files
internal lints
1 parent 7f52f24 commit 1ccef14

File tree

8 files changed

+12
-16
lines changed

8 files changed

+12
-16
lines changed

clippy_lints/src/comparison_chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<'tcx> LateLintPass<'tcx> for ComparisonChain {
7373
}
7474

7575
// Check that there exists at least one explicit else condition
76-
let (conds, _) = if_sequence(expr);
76+
let conds = if_sequence(expr).0;
7777
if conds.len() < 2 {
7878
return;
7979
}

clippy_lints/src/dereference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ fn report(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, state: State, data: Stat
508508
let mut app = Applicability::MachineApplicable;
509509
let (expr_str, expr_is_macro_call) = snippet_with_context(cx, expr.span, data.span.ctxt(), "..", &mut app);
510510
let ty = cx.typeck_results().expr_ty(expr);
511-
let (_, ref_count) = peel_mid_ty_refs(ty);
511+
let ref_count = peel_mid_ty_refs(ty).1;
512512
let deref_str = if ty_changed_count >= ref_count && ref_count != 0 {
513513
// a deref call changing &T -> &U requires two deref operators the first time
514514
// this occurs. One to remove the reference, a second to call the deref impl.

clippy_lints/src/indexing_slicing.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl<'tcx> LateLintPass<'tcx> for IndexingSlicing {
109109

110110
let const_range = to_const_range(cx, range, size);
111111

112-
if let (Some(start), _) = const_range {
112+
if let Some(start) = const_range.0 {
113113
if start > size {
114114
span_lint(
115115
cx,
@@ -121,7 +121,7 @@ impl<'tcx> LateLintPass<'tcx> for IndexingSlicing {
121121
}
122122
}
123123

124-
if let (_, Some(end)) = const_range {
124+
if let Some(end) = const_range.1 {
125125
if end > size {
126126
span_lint(
127127
cx,

clippy_lints/src/manual_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl LateLintPass<'_> for ManualMap {
150150
// Remove address-of expressions from the scrutinee. Either `as_ref` will be called, or
151151
// it's being passed by value.
152152
let scrutinee = peel_hir_expr_refs(scrutinee).0;
153-
let (scrutinee_str, _) = snippet_with_context(cx, scrutinee.span, expr_ctxt, "..", &mut app);
153+
let scrutinee_str = snippet_with_context(cx, scrutinee.span, expr_ctxt, "..", &mut app).0;
154154
let scrutinee_str =
155155
if scrutinee.span.ctxt() == expr.span.ctxt() && scrutinee.precedence().order() < PREC_POSTFIX {
156156
format!("({})", scrutinee_str)

clippy_lints/src/manual_strip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ fn len_arg<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> Option<&'tcx E
146146

147147
// Returns the length of the `expr` if it's a constant string or char.
148148
fn constant_length(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<u128> {
149-
let (value, _) = constant(cx, cx.typeck_results(), expr)?;
149+
let value = constant(cx, cx.typeck_results(), expr)?.0;
150150
match value {
151151
Constant::Str(value) => Some(value.len() as u128),
152152
Constant::Char(value) => Some(value.len_utf8() as u128),

clippy_lints/src/open_options.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,7 @@ fn get_open_options(cx: &LateContext<'_>, argument: &Expr<'_>, options: &mut Vec
6767
if match_type(cx, obj_ty, &paths::OPEN_OPTIONS) && arguments.len() >= 2 {
6868
let argument_option = match arguments[1].kind {
6969
ExprKind::Lit(ref span) => {
70-
if let Spanned {
71-
node: LitKind::Bool(lit),
72-
..
73-
} = *span
74-
{
70+
if let LitKind::Bool(lit) = span.node {
7571
if lit { Argument::True } else { Argument::False }
7672
} else {
7773
// The function is called with a literal which is not a boolean literal.

clippy_lints/src/utils/internal_lints/metadata_collector.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ fn extract_emission_info<'hir>(
677677
let mut multi_part = false;
678678

679679
for arg in args {
680-
let (arg_ty, _) = walk_ptrs_ty_depth(cx.typeck_results().expr_ty(arg));
680+
let arg_ty = walk_ptrs_ty_depth(cx.typeck_results().expr_ty(arg)).0;
681681

682682
if match_type(cx, arg_ty, &paths::LINT) {
683683
// If we found the lint arg, extract the lint name
@@ -810,7 +810,7 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for ApplicabilityResolver<'a, 'hir> {
810810
}
811811

812812
fn visit_expr(&mut self, expr: &'hir hir::Expr<'hir>) {
813-
let (expr_ty, _) = walk_ptrs_ty_depth(self.cx.typeck_results().expr_ty(expr));
813+
let expr_ty = walk_ptrs_ty_depth(self.cx.typeck_results().expr_ty(expr)).0;
814814

815815
if_chain! {
816816
if match_type(self.cx, expr_ty, &paths::APPLICABILITY);
@@ -900,7 +900,7 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for IsMultiSpanScanner<'a, 'hir> {
900900
}
901901
},
902902
ExprKind::MethodCall(path, _path_span, arg, _arg_span) => {
903-
let (self_ty, _) = walk_ptrs_ty_depth(self.cx.typeck_results().expr_ty(&arg[0]));
903+
let self_ty = walk_ptrs_ty_depth(self.cx.typeck_results().expr_ty(&arg[0])).0;
904904
if match_type(self.cx, self_ty, &paths::DIAGNOSTIC_BUILDER) {
905905
let called_method = path.ident.name.as_str().to_string();
906906
for (method_name, is_multi_part) in &SUGGESTION_DIAGNOSTIC_BUILDER_METHODS {

clippy_lints/src/write.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ impl Write {
624624
}
625625

626626
fn lint_println_empty_string(&self, cx: &EarlyContext<'_>, mac: &MacCall) {
627-
if let (Some(fmt_str), _) = self.check_tts(cx, mac.args.inner_tokens(), false) {
627+
if let Some(fmt_str) = self.check_tts(cx, mac.args.inner_tokens(), false).0 {
628628
if fmt_str.symbol == kw::Empty {
629629
let name = mac.path.segments[0].ident.name;
630630
span_lint_and_sugg(
@@ -641,7 +641,7 @@ impl Write {
641641
}
642642

643643
fn lint_print_with_newline(&self, cx: &EarlyContext<'_>, mac: &MacCall) {
644-
if let (Some(fmt_str), _) = self.check_tts(cx, mac.args.inner_tokens(), false) {
644+
if let Some(fmt_str) = self.check_tts(cx, mac.args.inner_tokens(), false).0 {
645645
if check_newlines(&fmt_str) {
646646
let name = mac.path.segments[0].ident.name;
647647
let suggested = format!("{}ln", name);

0 commit comments

Comments
 (0)