Skip to content

Commit 5fac16f

Browse files
committed
Remove the beef implementation
1 parent 0229743 commit 5fac16f

File tree

2 files changed

+5
-60
lines changed

2 files changed

+5
-60
lines changed

percent_encoding/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,3 @@ description = "Percent encoding and decoding"
66
repository = "https://github.com/servo/rust-url/"
77
license = "MIT/Apache-2.0"
88
edition = "2018"
9-
10-
[dependencies]
11-
beef = { version = "0.5", optional = true }

percent_encoding/src/lib.rs

Lines changed: 5 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@
4040
#![no_std]
4141
extern crate alloc;
4242

43-
use alloc::{borrow::{Cow, ToOwned}, vec::Vec, string::String};
43+
use alloc::{
44+
borrow::{Cow, ToOwned},
45+
string::String,
46+
vec::Vec,
47+
};
4448
use core::{fmt, mem, slice, str};
4549

4650
/// Represents a set of characters or bytes in the ASCII range.
@@ -307,42 +311,6 @@ impl<'a> From<PercentEncode<'a>> for Cow<'a, str> {
307311
}
308312
}
309313

310-
#[cfg(feature = "beef")]
311-
impl<'a> From<PercentEncode<'a>> for beef::Cow<'a, str> {
312-
fn from(mut iter: PercentEncode<'a>) -> Self {
313-
match iter.next() {
314-
None => "".into(),
315-
Some(first) => match iter.next() {
316-
None => first.into(),
317-
Some(second) => {
318-
let mut string = first.to_owned();
319-
string.push_str(second);
320-
string.extend(iter);
321-
string.into()
322-
}
323-
},
324-
}
325-
}
326-
}
327-
328-
#[cfg(all(feature = "beef", target_pointer_width = "64"))]
329-
impl<'a> From<PercentEncode<'a>> for beef::lean::Cow<'a, str> {
330-
fn from(mut iter: PercentEncode<'a>) -> Self {
331-
match iter.next() {
332-
None => "".into(),
333-
Some(first) => match iter.next() {
334-
None => first.into(),
335-
Some(second) => {
336-
let mut string = first.to_owned();
337-
string.push_str(second);
338-
string.extend(iter);
339-
string.into()
340-
}
341-
},
342-
}
343-
}
344-
}
345-
346314
/// Percent-decode the given string.
347315
///
348316
/// <https://url.spec.whatwg.org/#string-percent-decode>
@@ -420,26 +388,6 @@ impl<'a> From<PercentDecode<'a>> for Cow<'a, [u8]> {
420388
}
421389
}
422390

423-
#[cfg(feature = "beef")]
424-
impl<'a> From<PercentDecode<'a>> for beef::Cow<'a, [u8]> {
425-
fn from(iter: PercentDecode<'a>) -> Self {
426-
match iter.if_any() {
427-
Some(vec) => beef::Cow::owned(vec),
428-
None => beef::Cow::borrowed(iter.bytes.as_slice()),
429-
}
430-
}
431-
}
432-
433-
#[cfg(all(feature = "beef", target_pointer_width = "64"))]
434-
impl<'a> From<PercentDecode<'a>> for beef::lean::Cow<'a, [u8]> {
435-
fn from(iter: PercentDecode<'a>) -> Self {
436-
match iter.if_any() {
437-
Some(vec) => beef::lean::Cow::owned(vec),
438-
None => beef::lean::Cow::borrowed(iter.bytes.as_slice()),
439-
}
440-
}
441-
}
442-
443391
impl<'a> PercentDecode<'a> {
444392
/// If the percent-decoding is different from the input, return it as a new bytes vector.
445393
fn if_any(&self) -> Option<Vec<u8>> {

0 commit comments

Comments
 (0)