Skip to content

Commit 6842a52

Browse files
authored
Merge pull request #2079 from rust-lang-nursery/ptr_arg-vs-capacity
avoid linting `ptr_arg` if `.capacity()` is called.
2 parents 4ab2223 + 1e0268f commit 6842a52

File tree

8 files changed

+154
-103
lines changed

8 files changed

+154
-103
lines changed

Cargo.lock

Lines changed: 32 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clippy_lints/src/literal_digit_grouping.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,19 @@ impl LiteralDigitGrouping {
279279
let fractional_part = &parts[1].chars().rev().collect::<String>();
280280
let _ = Self::do_lint(fractional_part)
281281
.map(|fractional_group_size| {
282-
let consistent = Self::parts_consistent(integral_group_size, fractional_group_size, parts[0].len(), parts[1].len());
282+
let consistent = Self::parts_consistent(integral_group_size,
283+
fractional_group_size,
284+
parts[0].len(),
285+
parts[1].len());
283286
if !consistent {
284-
WarningType::InconsistentDigitGrouping.display(&digit_info.grouping_hint(), cx, &lit.span);
287+
WarningType::InconsistentDigitGrouping.display(&digit_info.grouping_hint(),
288+
cx,
289+
&lit.span);
285290
}
286291
})
287-
.map_err(|warning_type| warning_type.display(&digit_info.grouping_hint(), cx, &lit.span));
292+
.map_err(|warning_type| warning_type.display(&digit_info.grouping_hint(),
293+
cx,
294+
&lit.span));
288295
}
289296
})
290297
.map_err(|warning_type| warning_type.display(&digit_info.grouping_hint(), cx, &lit.span));
@@ -332,7 +339,8 @@ impl LiteralDigitGrouping {
332339
.windows(2)
333340
.all(|ps| ps[1] - ps[0] == group_size + 1)
334341
// number of digits to the left of the last group cannot be bigger than group size.
335-
&& (digits.len() - underscore_positions.last().expect("there's at least one element") <= group_size + 1);
342+
&& (digits.len() - underscore_positions.last()
343+
.expect("there's at least one element") <= group_size + 1);
336344

337345
if !consistent {
338346
return Err(WarningType::InconsistentDigitGrouping);

clippy_lints/src/missing_doc.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,7 @@
1515
// *rustc*'s
1616
// [`missing_doc`].
1717
//
18-
// [`missing_doc`]:
19-
// https://github.
20-
// com/rust-lang/rust/blob/d6d05904697d89099b55da3331155392f1db9c00/src/librustc_lint/builtin.
21-
//
22-
//
23-
//
24-
//
25-
//
26-
//
27-
// rs#L246
18+
// [`missing_doc`]: https://github.com/rust-lang/rust/blob/d6d05904697d89099b55da3331155392f1db9c00/src/librustc_lint/builtin.rs#L246
2819
//
2920

3021
use rustc::hir;

clippy_lints/src/print.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
124124
else if args.len() == 2 && match_def_path(cx.tcx, fun_id, &paths::FMT_ARGUMENTV1_NEW) {
125125
if let ExprPath(ref qpath) = args[1].node {
126126
if let Some(def_id) = opt_def_id(cx.tables.qpath_def(qpath, args[1].hir_id)) {
127-
if match_def_path(cx.tcx, def_id, &paths::DEBUG_FMT_METHOD) && !is_in_debug_impl(cx, expr) && is_expn_of(expr.span, "panic").is_none() {
127+
if match_def_path(cx.tcx, def_id, &paths::DEBUG_FMT_METHOD)
128+
&& !is_in_debug_impl(cx, expr) && is_expn_of(expr.span, "panic").is_none() {
128129
span_lint(cx, USE_DEBUG, args[0].span, "use of `Debug`-based formatting");
129130
}
130131
}

0 commit comments

Comments
 (0)