Skip to content

Commit f0abc7e

Browse files
authored
Remove mac, syn, `quote, and proc_macro2 dependencies (#663)
* Remove mac dependency Signed-off-by: Nico Burns <nico@nicoburns.com> * Remove unused syn, quote and proc_macro2 deps Signed-off-by: Nico Burns <nico@nicoburns.com> --------- Signed-off-by: Nico Burns <nico@nicoburns.com>
1 parent 631dbf5 commit f0abc7e

File tree

6 files changed

+8
-19
lines changed

6 files changed

+8
-19
lines changed

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,9 @@ html5ever = { version = "0.35.0", path = "html5ever" }
2929
encoding = "0.2"
3030
encoding_rs = "0.8.12"
3131
log = "0.4"
32-
mac = "0.1"
3332
new_debug_unreachable = "1.0.2"
3433
phf = "0.13"
3534
phf_codegen = "0.13"
36-
proc-macro2 = "1"
37-
quote = "1"
38-
syn = { version = "2", features = ["full"] }
3935
string_cache = "0.9.0"
4036
string_cache_codegen = "0.6.1"
4137
utf-8 = "0.7"

tendril/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ edition = "2015"
1616
[dependencies]
1717
encoding = { workspace = true, optional = true}
1818
encoding_rs = { workspace = true, optional = true}
19-
mac = { workspace = true }
2019
new_debug_unreachable = { workspace = true }
2120
utf-8 = { workspace = true }
2221

tendril/src/fmt.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,9 @@ unsafe impl Format for WTF8 {
386386
let mut i = 0;
387387
let mut prev_lead = false;
388388
while i < buf.len() {
389-
let codept = unwrap_or_return!(futf::classify(buf, i), false);
389+
let Some(codept) = futf::classify(buf, i) else {
390+
return false;
391+
};
390392
if !wtf8_meaningful(codept.meaning) {
391393
return false;
392394
}

tendril/src/futf.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,6 @@ unsafe fn unsafe_slice<'a>(buf: &'a [u8], start: usize, new_len: usize) -> &'a [
140140
slice::from_raw_parts(buf.as_ptr().offset(start as isize), new_len)
141141
}
142142

143-
macro_rules! otry {
144-
($x:expr) => {
145-
unwrap_or_return!($x, None)
146-
};
147-
}
148-
149143
/// Describes the UTF-8 codepoint containing the byte at index `idx` within
150144
/// `buf`.
151145
///
@@ -159,7 +153,7 @@ pub fn classify<'a>(buf: &'a [u8], idx: usize) -> Option<Codepoint<'a>> {
159153

160154
unsafe {
161155
let x = *buf.get_unchecked(idx);
162-
match otry!(Byte::classify(x)) {
156+
match Byte::classify(x)? {
163157
Byte::Ascii => Some(Codepoint {
164158
bytes: unsafe_slice(buf, idx, 1),
165159
rewind: 0,
@@ -172,7 +166,7 @@ pub fn classify<'a>(buf: &'a [u8], idx: usize) -> Option<Codepoint<'a>> {
172166
if !all_cont(unsafe_slice(bytes, 1, n - 1)) {
173167
return None;
174168
}
175-
let meaning = otry!(decode(bytes));
169+
let meaning = decode(bytes)?;
176170
Some(Codepoint {
177171
bytes: bytes,
178172
rewind: 0,
@@ -201,7 +195,7 @@ pub fn classify<'a>(buf: &'a [u8], idx: usize) -> Option<Codepoint<'a>> {
201195

202196
start -= 1;
203197
checked += 1;
204-
match otry!(Byte::classify(*buf.get_unchecked(start))) {
198+
match Byte::classify(*buf.get_unchecked(start))? {
205199
Byte::Cont => (),
206200
Byte::Start(n) => {
207201
let avail = buf.len() - start;
@@ -212,7 +206,7 @@ pub fn classify<'a>(buf: &'a [u8], idx: usize) -> Option<Codepoint<'a>> {
212206
return None;
213207
}
214208
}
215-
let meaning = otry!(decode(bytes));
209+
let meaning = decode(bytes)?;
216210
return Some(Codepoint {
217211
bytes: bytes,
218212
rewind: idx - start,

tendril/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ extern crate debug_unreachable;
3939
pub extern crate encoding;
4040
#[cfg(feature = "encoding_rs")]
4141
pub extern crate encoding_rs;
42-
#[macro_use]
43-
extern crate mac;
4442
extern crate utf8;
4543

4644
pub use fmt::Format;

tendril/src/tendril.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ where
13311331
let (class, first_mismatch);
13321332
{
13331333
let mut chars = unsafe { F::char_indices(self.as_byte_slice()) };
1334-
let (_, first) = unwrap_or_return!(chars.next(), None);
1334+
let (_, first) = chars.next()?;
13351335
class = classify(first);
13361336
first_mismatch = chars.find(|&(_, ch)| &classify(ch) != &class);
13371337
}

0 commit comments

Comments
 (0)