Skip to content

Commit 8f23554

Browse files
authored
Remove duplicated constants in graphemes bench (#25)
The graphemes benchmark code wasn't compiling. <details> <summary>Error</summary> ``` $ cargo build --all-targets --features graphemes Compiling crop v0.4.2 (/Users/evanrelf/Code/others/crop) error[E0255]: the name `LARGE` is defined multiple times --> benches/graphemes.rs:10:1 | 3 | use common::{LARGE, MEDIUM, SMALL, TINY}; | ----- previous import of the value `LARGE` here ... 10 | const LARGE: &str = include_str!("../tests/common/large.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `LARGE` redefined here | = note: `LARGE` must be defined only once in the value namespace of this module help: you can use `as` to change the binding name of the import | 3 | use common::{LARGE as OtherLARGE, MEDIUM, SMALL, TINY}; | +++++++++++++ error[E0255]: the name `MEDIUM` is defined multiple times --> benches/graphemes.rs:9:1 | 3 | use common::{LARGE, MEDIUM, SMALL, TINY}; | ------ previous import of the value `MEDIUM` here ... 9 | const MEDIUM: &str = include_str!("../tests/common/medium.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MEDIUM` redefined here | = note: `MEDIUM` must be defined only once in the value namespace of this module help: you can use `as` to change the binding name of the import | 3 | use common::{LARGE, MEDIUM as OtherMEDIUM, SMALL, TINY}; | ++++++++++++++ error[E0255]: the name `SMALL` is defined multiple times --> benches/graphemes.rs:8:1 | 3 | use common::{LARGE, MEDIUM, SMALL, TINY}; | ----- previous import of the value `SMALL` here ... 8 | const SMALL: &str = include_str!("../tests/common/small.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SMALL` redefined here | = note: `SMALL` must be defined only once in the value namespace of this module help: you can use `as` to change the binding name of the import | 3 | use common::{LARGE, MEDIUM, SMALL as OtherSMALL, TINY}; | +++++++++++++ error[E0255]: the name `TINY` is defined multiple times --> benches/graphemes.rs:7:1 | 3 | use common::{LARGE, MEDIUM, SMALL, TINY}; | ---- previous import of the value `TINY` here ... 7 | const TINY: &str = include_str!("../tests/common/tiny.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `TINY` redefined here | = note: `TINY` must be defined only once in the value namespace of this module help: you can use `as` to change the binding name of the import | 3 | use common::{LARGE, MEDIUM, SMALL, TINY as OtherTINY}; | ++++++++++++ warning: unused imports: `LARGE`, `MEDIUM`, `SMALL`, and `TINY` --> benches/graphemes.rs:3:14 | 3 | use common::{LARGE, MEDIUM, SMALL, TINY}; | ^^^^^ ^^^^^^ ^^^^^ ^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused import: `iter::Graphemes` --> benches/graphemes.rs:5:12 | 5 | use crop::{iter::Graphemes, Rope}; | ^^^^^^^^^^^^^^^ For more information about this error, try `rustc --explain E0255`. warning: `crop` (bench "graphemes") generated 2 warnings error: could not compile `crop` (bench "graphemes") due to 4 previous errors; 2 warnings emitted ``` </details>
1 parent af51af2 commit 8f23554

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

benches/graphemes.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@ mod common;
22

33
use common::{LARGE, MEDIUM, SMALL, TINY};
44
use criterion::{criterion_group, criterion_main, Criterion};
5-
use crop::{iter::Graphemes, Rope};
6-
7-
const TINY: &str = include_str!("../tests/common/tiny.txt");
8-
const SMALL: &str = include_str!("../tests/common/small.txt");
9-
const MEDIUM: &str = include_str!("../tests/common/medium.txt");
10-
const LARGE: &str = include_str!("../tests/common/large.txt");
5+
use crop::Rope;
116

127
fn iter_graphemes(c: &mut Criterion) {
138
let mut group = c.benchmark_group("iter_graphemes");

0 commit comments

Comments
 (0)