Skip to content

Commit 23f4e64

Browse files
committed
Convert unused doc comments to regular comments
1 parent 121e65f commit 23f4e64

File tree

29 files changed

+143
-142
lines changed

29 files changed

+143
-142
lines changed

compiler/rustc_ast/src/util/comments.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct Comment {
2626
/// Makes a doc string more presentable to users.
2727
/// Used by rustdoc and perhaps other tools, but not by rustc.
2828
pub fn beautify_doc_string(data: Symbol) -> String {
29-
/// remove whitespace-only lines from the start/end of lines
29+
// remove whitespace-only lines from the start/end of lines
3030
fn vertical_trim(lines: Vec<String>) -> Vec<String> {
3131
let mut i = 0;
3232
let mut j = lines.len();
@@ -50,7 +50,7 @@ pub fn beautify_doc_string(data: Symbol) -> String {
5050
lines[i..j].to_vec()
5151
}
5252

53-
/// remove a "[ \t]*\*" block from each line, if possible
53+
// remove a "[ \t]*\*" block from each line, if possible
5454
fn horizontal_trim(lines: Vec<String>) -> Vec<String> {
5555
let mut i = usize::MAX;
5656
let mut can_trim = true;

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,11 @@ impl Visitor<'_> for ImplTraitTypeIdVisitor<'_> {
419419

420420
impl<'a, 'hir> LoweringContext<'a, 'hir> {
421421
fn lower_crate(mut self, c: &Crate) -> hir::Crate<'hir> {
422-
/// Full-crate AST visitor that inserts into a fresh
423-
/// `LoweringContext` any information that may be
424-
/// needed from arbitrary locations in the crate,
425-
/// e.g., the number of lifetime generic parameters
426-
/// declared for every type and trait definition.
422+
// Full-crate AST visitor that inserts into a fresh
423+
// `LoweringContext` any information that may be
424+
// needed from arbitrary locations in the crate,
425+
// e.g., the number of lifetime generic parameters
426+
// declared for every type and trait definition.
427427
struct MiscCollector<'tcx, 'lowering, 'hir> {
428428
lctx: &'tcx mut LoweringContext<'lowering, 'hir>,
429429
hir_id_owner: Option<NodeId>,

compiler/rustc_errors/src/emitter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ impl EmitterWriter {
11601160
// `max_line_num_len`
11611161
let padding = " ".repeat(padding + label.len() + 5);
11621162

1163-
/// Returns `override` if it is present and `style` is `NoStyle` or `style` otherwise
1163+
// Returns `override` if it is present and `style` is `NoStyle` or `style` otherwise
11641164
fn style_or_override(style: Style, override_: Option<Style>) -> Style {
11651165
match (style, override_) {
11661166
(Style::NoStyle, Some(override_)) => override_,

compiler/rustc_index/src/bit_set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ impl<R: Idx, C: Idx> BitMatrix<R, C> {
900900

901901
impl<R: Idx, C: Idx> fmt::Debug for BitMatrix<R, C> {
902902
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
903-
/// Forces its contents to print in regular mode instead of alternate mode.
903+
// Forces its contents to print in regular mode instead of alternate mode.
904904
struct OneLinePrinter<T>(T);
905905
impl<T: fmt::Debug> fmt::Debug for OneLinePrinter<T> {
906906
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {

compiler/rustc_lint/src/builtin.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,8 +1658,8 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
16581658

16591659
use self::ast::{PatKind, RangeSyntax::DotDotDot};
16601660

1661-
/// If `pat` is a `...` pattern, return the start and end of the range, as well as the span
1662-
/// corresponding to the ellipsis.
1661+
// If `pat` is a `...` pattern, return the start and end of the range, as well as the span
1662+
// corresponding to the ellipsis.
16631663
fn matches_ellipsis_pat(pat: &ast::Pat) -> Option<(Option<&Expr>, &Expr, Span)> {
16641664
match &pat.kind {
16651665
PatKind::Range(
@@ -2348,11 +2348,11 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
23482348
Uninit,
23492349
};
23502350

2351-
/// Information about why a type cannot be initialized this way.
2352-
/// Contains an error message and optionally a span to point at.
2351+
// Information about why a type cannot be initialized this way.
2352+
// Contains an error message and optionally a span to point at.
23532353
type InitError = (String, Option<Span>);
23542354

2355-
/// Test if this constant is all-0.
2355+
// Test if this constant is all-0.
23562356
fn is_zero(expr: &hir::Expr<'_>) -> bool {
23572357
use hir::ExprKind::*;
23582358
use rustc_ast::LitKind::*;
@@ -2369,7 +2369,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
23692369
}
23702370
}
23712371

2372-
/// Determine if this expression is a "dangerous initialization".
2372+
// Determine if this expression is a "dangerous initialization".
23732373
fn is_dangerous_init(cx: &LateContext<'_>, expr: &hir::Expr<'_>) -> Option<InitKind> {
23742374
if let hir::ExprKind::Call(ref path_expr, ref args) = expr.kind {
23752375
// Find calls to `mem::{uninitialized,zeroed}` methods.
@@ -2409,16 +2409,16 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
24092409
None
24102410
}
24112411

2412-
/// Test if this enum has several actually "existing" variants.
2413-
/// Zero-sized uninhabited variants do not always have a tag assigned and thus do not "exist".
2412+
// Test if this enum has several actually "existing" variants.
2413+
// Zero-sized uninhabited variants do not always have a tag assigned and thus do not "exist".
24142414
fn is_multi_variant(adt: &ty::AdtDef) -> bool {
24152415
// As an approximation, we only count dataless variants. Those are definitely inhabited.
24162416
let existing_variants = adt.variants.iter().filter(|v| v.fields.is_empty()).count();
24172417
existing_variants > 1
24182418
}
24192419

2420-
/// Return `Some` only if we are sure this type does *not*
2421-
/// allow zero initialization.
2420+
// Return `Some` only if we are sure this type does *not*
2421+
// allow zero initialization.
24222422
fn ty_find_init_error<'tcx>(
24232423
tcx: TyCtxt<'tcx>,
24242424
ty: Ty<'tcx>,

compiler/rustc_middle/src/mir/query.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub struct GeneratorLayout<'tcx> {
167167

168168
impl Debug for GeneratorLayout<'_> {
169169
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
170-
/// Prints an iterator of (key, value) tuples as a map.
170+
// Prints an iterator of (key, value) tuples as a map.
171171
struct MapPrinter<'a, K, V>(Cell<Option<Box<dyn Iterator<Item = (K, V)> + 'a>>>);
172172
impl<'a, K, V> MapPrinter<'a, K, V> {
173173
fn new(iter: impl Iterator<Item = (K, V)> + 'a) -> Self {
@@ -180,7 +180,7 @@ impl Debug for GeneratorLayout<'_> {
180180
}
181181
}
182182

183-
/// Prints the generator variant name.
183+
// Prints the generator variant name.
184184
struct GenVariantPrinter(VariantIdx);
185185
impl From<VariantIdx> for GenVariantPrinter {
186186
fn from(idx: VariantIdx) -> Self {
@@ -198,7 +198,7 @@ impl Debug for GeneratorLayout<'_> {
198198
}
199199
}
200200

201-
/// Forces its contents to print in regular mode instead of alternate mode.
201+
// Forces its contents to print in regular mode instead of alternate mode.
202202
struct OneLinePrinter<T>(T);
203203
impl<T: Debug> Debug for OneLinePrinter<T> {
204204
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {

compiler/rustc_mir/src/interpret/operand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub struct ImmTy<'tcx, Tag = ()> {
9494

9595
impl<Tag: Copy> std::fmt::Display for ImmTy<'tcx, Tag> {
9696
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
97-
/// Helper function for printing a scalar to a FmtPrinter
97+
// Helper function for printing a scalar to a FmtPrinter
9898
fn p<'a, 'tcx, F: std::fmt::Write, Tag>(
9999
cx: FmtPrinter<'a, 'tcx, F>,
100100
s: ScalarMaybeUninit<Tag>,

compiler/rustc_mir/src/transform/simplify_try.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ fn get_arm_identity_info<'a, 'tcx>(
106106
matches!(stmt.kind, StatementKind::StorageLive(_) | StatementKind::StorageDead(_))
107107
}
108108

109-
/// Eats consecutive Statements which match `test`, performing the specified `action` for each.
110-
/// The iterator `stmt_iter` is not advanced if none were matched.
109+
// Eats consecutive Statements which match `test`, performing the specified `action` for each.
110+
// The iterator `stmt_iter` is not advanced if none were matched.
111111
fn try_eat<'a, 'tcx>(
112112
stmt_iter: &mut StmtIter<'a, 'tcx>,
113113
test: impl Fn(&'a Statement<'tcx>) -> bool,
@@ -120,8 +120,8 @@ fn get_arm_identity_info<'a, 'tcx>(
120120
}
121121
}
122122

123-
/// Eats consecutive `StorageLive` and `StorageDead` Statements.
124-
/// The iterator `stmt_iter` is not advanced if none were found.
123+
// Eats consecutive `StorageLive` and `StorageDead` Statements.
124+
// The iterator `stmt_iter` is not advanced if none were found.
125125
fn try_eat_storage_stmts<'a, 'tcx>(
126126
stmt_iter: &mut StmtIter<'a, 'tcx>,
127127
storage_live_stmts: &mut Vec<(usize, Local)>,
@@ -145,7 +145,7 @@ fn get_arm_identity_info<'a, 'tcx>(
145145
}
146146
}
147147

148-
/// Eats consecutive `Assign` Statements.
148+
// Eats consecutive `Assign` Statements.
149149
// The iterator `stmt_iter` is not advanced if none were found.
150150
fn try_eat_assign_tmp_stmts<'a, 'tcx>(
151151
stmt_iter: &mut StmtIter<'a, 'tcx>,

compiler/rustc_mir_build/src/thir/pattern/_match.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,9 +2431,9 @@ fn split_grouped_constructors<'p, 'tcx>(
24312431
continue;
24322432
}
24332433

2434-
/// Represents a border between 2 integers. Because the intervals spanning borders
2435-
/// must be able to cover every integer, we need to be able to represent
2436-
/// 2^128 + 1 such borders.
2434+
// Represents a border between 2 integers. Because the intervals spanning borders
2435+
// must be able to cover every integer, we need to be able to represent
2436+
// 2^128 + 1 such borders.
24372437
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
24382438
enum Border {
24392439
JustBefore(u128),

compiler/rustc_parse/src/parser/nonterminal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ impl<'a> Parser<'a> {
1212
/// Returning `false` is a *stability guarantee* that such a matcher will *never* begin with that
1313
/// token. Be conservative (return true) if not sure.
1414
pub fn nonterminal_may_begin_with(kind: NonterminalKind, token: &Token) -> bool {
15-
/// Checks whether the non-terminal may contain a single (non-keyword) identifier.
15+
// Checks whether the non-terminal may contain a single (non-keyword) identifier.
1616
fn may_be_ident(nt: &token::Nonterminal) -> bool {
1717
match *nt {
1818
token::NtItem(_) | token::NtBlock(_) | token::NtVis(_) | token::NtLifetime(_) => {

0 commit comments

Comments
 (0)