Skip to content

Commit d6d98d3

Browse files
committed
Backport to Rust 1.15
* Avoid using some missing From impls * Manually re-order fields
1 parent 3bca44d commit d6d98d3

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/compact_cow_str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl<'a> Clone for CompactCowStr<'a> {
105105
if self.is_borrowed() {
106106
CompactCowStr { ..*self }
107107
} else {
108-
Self::from(Box::from(&**self))
108+
Self::from(String::from(&**self).into_boxed_str())
109109
}
110110
}
111111
}
@@ -142,7 +142,7 @@ impl<'a> From<CompactCowStr<'a>> for Cow<'a, str> {
142142
if is_borrowed {
143143
Cow::Borrowed(&*raw)
144144
} else {
145-
Cow::Owned(String::from(Box::from_raw(raw as *mut str)))
145+
Cow::Owned(Box::from_raw(raw as *mut str).into_string())
146146
}
147147
}
148148
}

src/tokenizer.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,17 @@ pub enum Token<'a> {
6060

6161
/// A [`<dimension-token>`](https://drafts.csswg.org/css-syntax/#dimension-token-diagram)
6262
Dimension {
63+
/// Whether the number had a `+` or `-` sign.
64+
///
65+
/// This is used is some cases like the <An+B> micro syntax. (See the `parse_nth` function.)
66+
has_sign: bool,
67+
6368
/// The value as a float
6469
value: f32,
6570

6671
/// If the origin source did not include a fractional part, the value as an integer.
6772
int_value: Option<i32>,
6873

69-
/// Whether the number had a `+` or `-` sign.
70-
///
71-
/// This is used is some cases like the <An+B> micro syntax. (See the `parse_nth` function.)
72-
has_sign: bool,
73-
7474
/// The unit, e.g. "px" in `12px`
7575
unit: CompactCowStr<'a>
7676
},

0 commit comments

Comments
 (0)