Skip to content

Commit 1fd2a2d

Browse files
authored
Auto merge of #57 - mbrubeck:flame, r=Manishearth
Update to flame 0.2 and flamer 0.4 The old versions were implemented as compiler plugins for very old nightly rustc builds. The new versions are compatible with stable Rust. r? @Manishearth
2 parents ddfc168 + 77d06d2 commit 1fd2a2d

File tree

7 files changed

+16
-21
lines changed

7 files changed

+16
-21
lines changed

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ appveyor = { repository = "servo/unicode-bidi" }
2727
name = "unicode_bidi"
2828

2929
[dependencies]
30-
flame = { version = "0.1", optional = true }
31-
flamer = { version = "0.1", optional = true }
30+
flame = { version = "0.2", optional = true }
31+
flamer = { version = "0.4", optional = true }
3232
matches = "0.1"
3333
serde = { version = ">=0.8, <2.0", optional = true, features = ["derive"] }
3434

examples/flame_udhr.rs

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010

1111
//! Profiling example
1212
13-
#![cfg_attr(feature="flame_it", feature(plugin, custom_attribute))]
14-
#![cfg_attr(feature="flame_it", plugin(flamer))]
15-
1613
#[cfg(feature = "flame_it")]
1714
fn main() {
1815
use std::fs::File;

src/explicit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use super::level::Level;
2020
///
2121
/// `processing_classes[i]` must contain the `BidiClass` of the char at byte index `i`,
2222
/// for each char in `text`.
23-
#[cfg_attr(feature = "flame_it", flame)]
23+
#[cfg_attr(feature = "flame_it", flamer::flame)]
2424
pub fn compute(
2525
text: &str,
2626
para_level: Level,

src/implicit.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use super::level::Level;
1919
/// 3.3.4 Resolving Weak Types
2020
///
2121
/// <http://www.unicode.org/reports/tr9/#Resolving_Weak_Types>
22-
#[cfg_attr(feature = "flame_it", flame)]
22+
#[cfg_attr(feature = "flame_it", flamer::flame)]
2323
pub fn resolve_weak(sequence: &IsolatingRunSequence, processing_classes: &mut [BidiClass]) {
2424
// FIXME (#8): This function applies steps W1-W6 in a single pass. This can produce
2525
// incorrect results in cases where a "later" rule changes the value of `prev_class` seen
@@ -134,7 +134,7 @@ pub fn resolve_weak(sequence: &IsolatingRunSequence, processing_classes: &mut [B
134134
/// 3.3.5 Resolving Neutral Types
135135
///
136136
/// <http://www.unicode.org/reports/tr9/#Resolving_Neutral_Types>
137-
#[cfg_attr(feature = "flame_it", flame)]
137+
#[cfg_attr(feature = "flame_it", flamer::flame)]
138138
pub fn resolve_neutral(
139139
sequence: &IsolatingRunSequence,
140140
levels: &[Level],
@@ -199,7 +199,7 @@ pub fn resolve_neutral(
199199
/// Returns the maximum embedding level in the paragraph.
200200
///
201201
/// <http://www.unicode.org/reports/tr9/#Resolving_Implicit_Levels>
202-
#[cfg_attr(feature = "flame_it", flame)]
202+
#[cfg_attr(feature = "flame_it", flamer::flame)]
203203
pub fn resolve_levels(original_classes: &[BidiClass], levels: &mut [Level]) -> Level {
204204
let mut max_level = Level::ltr();
205205

src/level.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ mod tests {
328328
#[test]
329329
fn test_into() {
330330
let level = Level::rtl();
331-
assert_eq!(1u8, level.into());
331+
let number: u8 = level.into();
332+
assert_eq!(1u8, number);
332333
}
333334

334335
#[test]

src/lib.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@
5757
5858
#![forbid(unsafe_code)]
5959

60-
#![cfg_attr(feature="flame_it", feature(plugin, custom_attribute))]
61-
#![cfg_attr(feature="flame_it", plugin(flamer))]
62-
6360
pub mod deprecated;
6461
pub mod format_chars;
6562
pub mod level;
@@ -119,7 +116,7 @@ impl<'text> InitialInfo<'text> {
119116
/// Also sets the class for each First Strong Isolate initiator (FSI) to LRI or RLI if a strong
120117
/// character is found before the matching PDI. If no strong character is found, the class will
121118
/// remain FSI, and it's up to later stages to treat these as LRI when needed.
122-
#[cfg_attr(feature = "flame_it", flame)]
119+
#[cfg_attr(feature = "flame_it", flamer::flame)]
123120
pub fn new(text: &str, default_para_level: Option<Level>) -> InitialInfo<'_> {
124121
let mut original_classes = Vec::with_capacity(text.len());
125122

@@ -245,7 +242,7 @@ impl<'text> BidiInfo<'text> {
245242
/// text that is entirely LTR. See the `nsBidi` class from Gecko for comparison.
246243
///
247244
/// TODO: Support auto-RTL base direction
248-
#[cfg_attr(feature = "flame_it", flame)]
245+
#[cfg_attr(feature = "flame_it", flamer::flame)]
249246
pub fn new(text: &str, default_para_level: Option<Level>) -> BidiInfo<'_> {
250247
let InitialInfo {
251248
original_classes,
@@ -293,15 +290,15 @@ impl<'text> BidiInfo<'text> {
293290

294291
/// Re-order a line based on resolved levels and return only the embedding levels, one `Level`
295292
/// per *byte*.
296-
#[cfg_attr(feature = "flame_it", flame)]
293+
#[cfg_attr(feature = "flame_it", flamer::flame)]
297294
pub fn reordered_levels(&self, para: &ParagraphInfo, line: Range<usize>) -> Vec<Level> {
298295
let (levels, _) = self.visual_runs(para, line);
299296
levels
300297
}
301298

302299
/// Re-order a line based on resolved levels and return only the embedding levels, one `Level`
303300
/// per *character*.
304-
#[cfg_attr(feature = "flame_it", flame)]
301+
#[cfg_attr(feature = "flame_it", flamer::flame)]
305302
pub fn reordered_levels_per_char(
306303
&self,
307304
para: &ParagraphInfo,
@@ -313,7 +310,7 @@ impl<'text> BidiInfo<'text> {
313310

314311

315312
/// Re-order a line based on resolved levels and return the line in display order.
316-
#[cfg_attr(feature = "flame_it", flame)]
313+
#[cfg_attr(feature = "flame_it", flamer::flame)]
317314
pub fn reorder_line(&self, para: &ParagraphInfo, line: Range<usize>) -> Cow<'text, str> {
318315
let (levels, runs) = self.visual_runs(para, line.clone());
319316

@@ -338,7 +335,7 @@ impl<'text> BidiInfo<'text> {
338335
/// `line` is a range of bytes indices within `levels`.
339336
///
340337
/// <http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels>
341-
#[cfg_attr(feature = "flame_it", flame)]
338+
#[cfg_attr(feature = "flame_it", flamer::flame)]
342339
pub fn visual_runs(
343340
&self,
344341
para: &ParagraphInfo,
@@ -463,7 +460,7 @@ impl<'text> BidiInfo<'text> {
463460
///
464461
/// The levels assigned to these characters are not specified by the algorithm. This function
465462
/// assigns each one the level of the previous character, to avoid breaking level runs.
466-
#[cfg_attr(feature = "flame_it", flame)]
463+
#[cfg_attr(feature = "flame_it", flamer::flame)]
467464
fn assign_levels_to_removed_chars(para_level: Level, classes: &[BidiClass], levels: &mut [Level]) {
468465
for i in 0..levels.len() {
469466
if prepare::removed_by_x9(classes[i]) {

src/prepare.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub struct IsolatingRunSequence {
4040
/// whose matching PDI is the first character of the next level run in the sequence.
4141
///
4242
/// Note: This function does *not* return the sequences in order by their first characters.
43-
#[cfg_attr(feature = "flame_it", flame)]
43+
#[cfg_attr(feature = "flame_it", flamer::flame)]
4444
pub fn isolating_run_sequences(
4545
para_level: Level,
4646
original_classes: &[BidiClass],

0 commit comments

Comments
 (0)