File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
25
25
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26
26
refs/heads/beta: 83dee3dfbb452a7558193f3ce171b3c60bf4a499
27
27
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28
- refs/heads/tmp: 66109d2c38b4ff2b1e097014fa4710682937a10b
28
+ refs/heads/tmp: 5b0721d0fe390ff3f6741cdf15bf93b8a1df2879
29
29
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
30
30
refs/tags/homu-tmp: e58601ab085591c71a27ae82137fc313222c2270
31
31
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ race condition can't violate memory safety in a Rust program on
25
25
its own. Only in conjunction with some other unsafe code can a race condition
26
26
actually violate memory safety. For instance:
27
27
28
- ``` rust,no_run
28
+ ``` rust,norun
29
29
use std::thread;
30
30
use std::sync::atomic::{AtomicUsize, Ordering};
31
31
use std::sync::Arc;
@@ -56,7 +56,7 @@ thread::spawn(move || {
56
56
println!("{}", data[idx.load(Ordering::SeqCst)]);
57
57
```
58
58
59
- ``` rust,no_run
59
+ ``` rust,norun
60
60
use std::thread;
61
61
use std::sync::atomic::{AtomicUsize, Ordering};
62
62
use std::sync::Arc;
Original file line number Diff line number Diff line change @@ -29,13 +29,14 @@ use test::{TestOptions, Collector};
29
29
/// Separate any lines at the start of the file that begin with `%`.
30
30
fn extract_leading_metadata < ' a > ( s : & ' a str ) -> ( Vec < & ' a str > , & ' a str ) {
31
31
let mut metadata = Vec :: new ( ) ;
32
+ let mut count = 0 ;
32
33
for line in s. lines ( ) {
33
34
if line. starts_with ( "%" ) {
34
35
// remove %<whitespace>
35
- metadata. push ( line[ 1 ..] . trim_left ( ) )
36
+ metadata. push ( line[ 1 ..] . trim_left ( ) ) ;
37
+ count += line. len ( ) + 1 ;
36
38
} else {
37
- let line_start_byte = s. find ( line) . unwrap ( ) ;
38
- return ( metadata, & s[ line_start_byte..] ) ;
39
+ return ( metadata, & s[ count..] ) ;
39
40
}
40
41
}
41
42
// if we're here, then all lines were metadata % lines.
You can’t perform that action at this time.
0 commit comments