diff options
Diffstat (limited to 'src/libsyntax_pos/lib.rs')
| -rw-r--r-- | src/libsyntax_pos/lib.rs | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index 70c45f7f9a7..bffc686b816 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -67,7 +67,7 @@ scoped_tls::scoped_thread_local!(pub static GLOBALS: Globals); #[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash, RustcDecodable, RustcEncodable)] pub enum FileName { Real(PathBuf), - /// A macro. This includes the full name of the macro, so that there are no clashes. + /// A macro. This includes the full name of the macro, so that there are no clashes. Macros(String), /// Call to `quote!`. QuoteExpansion(u64), @@ -304,21 +304,21 @@ impl Span { if self.is_dummy() { other } else { self } } - /// Return `true` if `self` fully encloses `other`. + /// Returns `true` if `self` fully encloses `other`. pub fn contains(self, other: Span) -> bool { let span = self.data(); let other = other.data(); span.lo <= other.lo && other.hi <= span.hi } - /// Return `true` if `self` touches `other`. + /// Returns `true` if `self` touches `other`. pub fn overlaps(self, other: Span) -> bool { let span = self.data(); let other = other.data(); span.lo < other.hi && other.lo < span.hi } - /// Return true if the spans are equal with regards to the source text. + /// Returns `true` if the spans are equal with regards to the source text. /// /// Use this instead of `==` when either span could be generated code, /// and you only care that they point to the same bytes of source text. @@ -339,7 +339,7 @@ impl Span { } } - /// Return the source span -- this is either the supplied span, or the span for + /// Returns the source span -- this is either the supplied span, or the span for /// the macro callsite that expanded to it. pub fn source_callsite(self) -> Span { self.ctxt().outer().expn_info().map(|info| info.call_site.source_callsite()).unwrap_or(self) @@ -367,7 +367,7 @@ impl Span { self.edition() >= edition::Edition::Edition2018 } - /// Return the source callee. + /// Returns the source callee. /// /// Returns `None` if the supplied span has no expansion trace, /// else returns the `ExpnInfo` for the macro definition @@ -382,7 +382,7 @@ impl Span { self.ctxt().outer().expn_info().map(source_callee) } - /// Check if a span is "internal" to a macro in which `#[unstable]` + /// Checks if a span is "internal" to a macro in which `#[unstable]` /// items can be used (that is, a macro marked with /// `#[allow_internal_unstable]`). pub fn allows_unstable(&self) -> bool { @@ -392,7 +392,7 @@ impl Span { } } - /// Check if this span arises from a compiler desugaring of kind `kind`. + /// Checks if this span arises from a compiler desugaring of kind `kind`. pub fn is_compiler_desugaring(&self, kind: CompilerDesugaringKind) -> bool { match self.ctxt().outer().expn_info() { Some(info) => match info.format { @@ -403,7 +403,7 @@ impl Span { } } - /// Return the compiler desugaring that created this span, or `None` + /// Returns the compiler desugaring that created this span, or `None` /// if this span is not from a desugaring. pub fn compiler_desugaring_kind(&self) -> Option<CompilerDesugaringKind> { match self.ctxt().outer().expn_info() { @@ -415,7 +415,7 @@ impl Span { } } - /// Check if a span is "internal" to a macro in which `unsafe` + /// Checks if a span is "internal" to a macro in which `unsafe` /// can be used without triggering the `unsafe_code` lint // (that is, a macro marked with `#[allow_internal_unsafe]`). pub fn allows_unsafe(&self) -> bool { @@ -449,7 +449,7 @@ impl Span { result } - /// Return a `Span` that would enclose both `self` and `end`. + /// Returns a `Span` that would enclose both `self` and `end`. pub fn to(self, end: Span) -> Span { let span_data = self.data(); let end_data = end.data(); @@ -472,7 +472,7 @@ impl Span { ) } - /// Return a `Span` between the end of `self` to the beginning of `end`. + /// Returns a `Span` between the end of `self` to the beginning of `end`. pub fn between(self, end: Span) -> Span { let span = self.data(); let end = end.data(); @@ -483,7 +483,7 @@ impl Span { ) } - /// Return a `Span` between the beginning of `self` to the beginning of `end`. + /// Returns a `Span` between the beginning of `self` to the beginning of `end`. pub fn until(self, end: Span) -> Span { let span = self.data(); let end = end.data(); @@ -655,7 +655,7 @@ impl MultiSpan { &self.primary_spans } - /// Returns whether any of the primary spans is displayable. + /// Returns `true` if any of the primary spans are displayable. pub fn has_primary_spans(&self) -> bool { self.primary_spans.iter().any(|sp| !sp.is_dummy()) } @@ -672,7 +672,7 @@ impl MultiSpan { } /// Replaces all occurrences of one Span with another. Used to move `Span`s in areas that don't - /// display well (like std macros). Returns true if replacements occurred. + /// display well (like std macros). Returns whether replacements occurred. pub fn replace(&mut self, before: Span, after: Span) -> bool { let mut replacements_occurred = false; for primary_span in &mut self.primary_spans { @@ -719,7 +719,7 @@ impl MultiSpan { span_labels } - /// Returns whether any of the span labels is displayable. + /// Returns `true` if any of the span labels is displayable. pub fn has_span_labels(&self) -> bool { self.span_labels.iter().any(|(sp, _)| !sp.is_dummy()) } @@ -848,7 +848,7 @@ pub struct SourceFile { /// originate from files has names between angle brackets by convention /// (e.g., `<anon>`). pub name: FileName, - /// True if the `name` field above has been modified by `--remap-path-prefix`. + /// `true` if the `name` field above has been modified by `--remap-path-prefix`. pub name_was_remapped: bool, /// The unmapped path of the file that the source came from. /// Set to `None` if the `SourceFile` was imported from an external crate. @@ -1057,7 +1057,7 @@ impl SourceFile { } } - /// Return the `BytePos` of the beginning of the current line. + /// Returns the `BytePos` of the beginning of the current line. pub fn line_begin_pos(&self, pos: BytePos) -> BytePos { let line_index = self.lookup_line(pos).unwrap(); self.lines[line_index] @@ -1096,7 +1096,7 @@ impl SourceFile { } } - /// Get a line from the list of pre-computed line-beginnings. + /// Gets a line from the list of pre-computed line-beginnings. /// The line number here is 0-based. pub fn get_line(&self, line_number: usize) -> Option<Cow<'_, str>> { fn get_until_newline(src: &str, begin: usize) -> &str { @@ -1144,7 +1144,7 @@ impl SourceFile { self.lines.len() } - /// Find the line containing the given position. The return value is the + /// Finds the line containing the given position. The return value is the /// index into the `lines` array of this `SourceFile`, not the 1-based line /// number. If the source_file is empty or the position is located before the /// first line, `None` is returned. @@ -1181,7 +1181,7 @@ impl SourceFile { } } -/// Remove utf-8 BOM if any. +/// Removes UTF-8 BOM, if any. fn remove_bom(src: &mut String) { if src.starts_with("\u{feff}") { src.drain(..3); |
