Skip to content

Commit e1ab116

Browse files
committed
Fix up some comments.
Some are too long (> 100 chars), some are twoo short, some are missing full stops, some are missing upper-case letters at the start of sentences.
1 parent ea1d9eb commit e1ab116

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

compiler/rustc_attr_parsing/src/context.rs

+15-16
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ impl<'a> Deref for AcceptContext<'a> {
115115

116116
/// Context given to every attribute parser during finalization.
117117
///
118-
/// Gives [`AttributeParser`](crate::attributes::AttributeParser)s enough information to create errors, for example.
118+
/// Gives [`AttributeParser`](crate::attributes::AttributeParser)s enough information to create
119+
/// errors, for example.
119120
pub(crate) struct FinalizeContext<'a> {
120121
/// The parse context, gives access to the session and the
121122
/// diagnostics context.
@@ -146,10 +147,9 @@ pub struct AttributeParser<'sess> {
146147
sess: &'sess Session,
147148
features: Option<&'sess Features>,
148149

149-
/// *only* parse attributes with this symbol.
150+
/// *Only* parse attributes with this symbol.
150151
///
151-
/// Used in cases where we want the lowering infrastructure for
152-
/// parse just a single attribute.
152+
/// Used in cases where we want the lowering infrastructure for parse just a single attribute.
153153
parse_only: Option<Symbol>,
154154

155155
/// Can be used to instruct parsers to reduce the number of diagnostics it emits.
@@ -162,9 +162,9 @@ impl<'sess> AttributeParser<'sess> {
162162
/// One example where this is necessary, is to parse `feature` attributes themselves for
163163
/// example.
164164
///
165-
/// Try to use this as little as possible. Attributes *should* be lowered during `rustc_ast_lowering`.
166-
/// Some attributes require access to features to parse, which would crash if you tried to do so
167-
/// through [`parse_limited`](Self::parse_limited).
165+
/// Try to use this as little as possible. Attributes *should* be lowered during
166+
/// `rustc_ast_lowering`. Some attributes require access to features to parse, which would
167+
/// crash if you tried to do so through [`parse_limited`](Self::parse_limited).
168168
///
169169
/// To make sure use is limited, supply a `Symbol` you'd like to parse. Only attributes with
170170
/// that symbol are picked out of the list of instructions and parsed. Those are returned.
@@ -222,19 +222,18 @@ impl<'sess> AttributeParser<'sess> {
222222
let group_cx = FinalizeContext { cx: self, target_span };
223223

224224
for attr in attrs {
225-
// if we're only looking for a single attribute,
226-
// skip all the ones we don't care about
225+
// If we're only looking for a single attribute, skip all the ones we don't care about.
227226
if let Some(expected) = self.parse_only {
228227
if !attr.has_name(expected) {
229228
continue;
230229
}
231230
}
232231

233-
// sometimes, for example for `#![doc = include_str!("readme.md")]`,
232+
// Sometimes, for example for `#![doc = include_str!("readme.md")]`,
234233
// doc still contains a non-literal. You might say, when we're lowering attributes
235234
// that's expanded right? But no, sometimes, when parsing attributes on macros,
236235
// we already use the lowering logic and these are still there. So, when `omit_doc`
237-
// is set we *also* want to ignore these
236+
// is set we *also* want to ignore these.
238237
if omit_doc == OmitDoc::Skip && attr.has_name(sym::doc) {
239238
continue;
240239
}
@@ -276,11 +275,11 @@ impl<'sess> AttributeParser<'sess> {
276275

277276
accept(&cx, &args)
278277
} else {
279-
// if we're here, we must be compiling a tool attribute... Or someone forgot to
280-
// parse their fancy new attribute. Let's warn them in any case. If you are that
281-
// person, and you really your attribute should remain unparsed, carefully read the
282-
// documentation in this module and if you still think so you can add an exception
283-
// to this assertion.
278+
// If we're here, we must be compiling a tool attribute... Or someone
279+
// forgot to parse their fancy new attribute. Let's warn them in any case.
280+
// If you are that person, and you really think your attribute should
281+
// remain unparsed, carefully read the documentation in this module and if
282+
// you still think so you can add an exception to this assertion.
284283

285284
// FIXME(jdonszelmann): convert other attributes, and check with this that
286285
// we caught em all

0 commit comments

Comments
 (0)