diff options
| author | Alexander Regueiro <alexreg@me.com> | 2019-09-06 03:56:45 +0100 |
|---|---|---|
| committer | Alexander Regueiro <alexreg@me.com> | 2019-09-07 16:29:04 +0100 |
| commit | 49d2fd1725510fd3bf6f2937e178b1aa055ddb02 (patch) | |
| tree | a04455dea49b29d2c981573bd920116f0418024b /src/libsyntax/tests.rs | |
| parent | ef54f57c5b9d894a38179d09b00610c1b337b086 (diff) | |
| download | rust-49d2fd1725510fd3bf6f2937e178b1aa055ddb02.tar.gz rust-49d2fd1725510fd3bf6f2937e178b1aa055ddb02.zip | |
Aggregation of cosmetic changes made during work on REPL PRs: libsyntax
Diffstat (limited to 'src/libsyntax/tests.rs')
| -rw-r--r-- | src/libsyntax/tests.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libsyntax/tests.rs b/src/libsyntax/tests.rs index 9b90b31f2d2..540881b0a54 100644 --- a/src/libsyntax/tests.rs +++ b/src/libsyntax/tests.rs @@ -18,7 +18,7 @@ use std::path::{Path, PathBuf}; use std::str; use std::sync::{Arc, Mutex}; -/// Map string to parser (via tts) +/// Map string to parser (via tts). fn string_to_parser(ps: &ParseSess, source_str: String) -> Parser<'_> { new_parser_from_source_str(ps, PathBuf::from("bogofile").into(), source_str) } @@ -32,7 +32,7 @@ crate fn with_error_checking_parse<'a, T, F>(s: String, ps: &'a ParseSess, f: F) x } -/// Map a string to tts, using a made-up filename: +/// Maps a string to tts, using a made-up filename. crate fn string_to_stream(source_str: String) -> TokenStream { let ps = ParseSess::new(FilePathMapping::empty()); source_file_to_stream( @@ -42,7 +42,7 @@ crate fn string_to_stream(source_str: String) -> TokenStream { ), None).0 } -/// Parse a string, return a crate. +/// Parses a string, returns a crate. crate fn string_to_crate(source_str : String) -> ast::Crate { let ps = ParseSess::new(FilePathMapping::empty()); with_error_checking_parse(source_str, &ps, |p| { @@ -64,7 +64,7 @@ crate fn matches_codepattern(a : &str, b : &str) -> bool { (None, _) => return false, (Some(&a), None) => { if rustc_lexer::is_whitespace(a) { - break // trailing whitespace check is out of loop for borrowck + break // Trailing whitespace check is out of loop for borrowck. } else { return false } @@ -73,11 +73,11 @@ crate fn matches_codepattern(a : &str, b : &str) -> bool { }; if rustc_lexer::is_whitespace(a) && rustc_lexer::is_whitespace(b) { - // skip whitespace for a and b + // Skip whitespace for `a` and `b`. scan_for_non_ws_or_end(&mut a_iter); scan_for_non_ws_or_end(&mut b_iter); } else if rustc_lexer::is_whitespace(a) { - // skip whitespace for a + // Skip whitespace for `a`. scan_for_non_ws_or_end(&mut a_iter); } else if a == b { a_iter.next(); @@ -87,18 +87,18 @@ crate fn matches_codepattern(a : &str, b : &str) -> bool { } } - // check if a has *only* trailing whitespace + // Check if a has *only* trailing whitespace. a_iter.all(rustc_lexer::is_whitespace) } -/// Advances the given peekable `Iterator` until it reaches a non-whitespace character +/// Advances the given peekable `Iterator` until it reaches a non-whitespace character. fn scan_for_non_ws_or_end<I: Iterator<Item = char>>(iter: &mut Peekable<I>) { while iter.peek().copied().map(|c| rustc_lexer::is_whitespace(c)) == Some(true) { iter.next(); } } -/// Identify a position in the text by the Nth occurrence of a string. +/// Identifies a position in the text by the n'th occurrence of a string. struct Position { string: &'static str, count: usize, |
