Skip to content

Commit 2f80b72

Browse files
committed
Remove Arg::as_maybe_utf8_bytes, which isn't used anywhere.
This made `Arg` more work to implement for new types, isn't needed, and in practice is as awkward as the "maybe" name suggests.
1 parent f40ba8b commit 2f80b72

File tree

2 files changed

+0
-135
lines changed

2 files changed

+0
-135
lines changed

src/path/arg.rs

Lines changed: 0 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ pub trait Arg {
6767
where
6868
Self: 'b;
6969

70-
/// Returns a view of this string as a byte slice.
71-
fn as_maybe_utf8_bytes(&self) -> &[u8];
72-
7370
/// Runs a closure with `self` passed in as a `&ZStr`.
7471
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
7572
where
@@ -131,11 +128,6 @@ impl Arg for &str {
131128
))
132129
}
133130

134-
#[inline]
135-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
136-
self.as_bytes()
137-
}
138-
139131
#[inline]
140132
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
141133
where
@@ -172,11 +164,6 @@ impl Arg for &String {
172164
self.as_str().into_z_str()
173165
}
174166

175-
#[inline]
176-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
177-
self.as_bytes()
178-
}
179-
180167
#[inline]
181168
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
182169
where
@@ -215,11 +202,6 @@ impl Arg for String {
215202
))
216203
}
217204

218-
#[inline]
219-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
220-
self.as_bytes()
221-
}
222-
223205
#[inline]
224206
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
225207
where
@@ -259,11 +241,6 @@ impl Arg for &OsStr {
259241
))
260242
}
261243

262-
#[inline]
263-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
264-
self.as_bytes()
265-
}
266-
267244
#[inline]
268245
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
269246
where
@@ -302,11 +279,6 @@ impl Arg for &OsString {
302279
self.as_os_str().into_z_str()
303280
}
304281

305-
#[inline]
306-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
307-
self.as_bytes()
308-
}
309-
310282
#[inline]
311283
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
312284
where
@@ -346,11 +318,6 @@ impl Arg for OsString {
346318
))
347319
}
348320

349-
#[inline]
350-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
351-
self.as_bytes()
352-
}
353-
354321
#[inline]
355322
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
356323
where
@@ -390,11 +357,6 @@ impl Arg for &Path {
390357
))
391358
}
392359

393-
#[inline]
394-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
395-
self.as_os_str().as_bytes()
396-
}
397-
398360
#[inline]
399361
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
400362
where
@@ -436,11 +398,6 @@ impl Arg for &PathBuf {
436398
self.as_path().into_z_str()
437399
}
438400

439-
#[inline]
440-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
441-
PathBuf::as_path(self).as_os_str().as_bytes()
442-
}
443-
444401
#[inline]
445402
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
446403
where
@@ -480,11 +437,6 @@ impl Arg for PathBuf {
480437
))
481438
}
482439

483-
#[inline]
484-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
485-
self.as_os_str().as_bytes()
486-
}
487-
488440
#[inline]
489441
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
490442
where
@@ -522,11 +474,6 @@ impl Arg for &ZStr {
522474
Ok(Cow::Borrowed(self))
523475
}
524476

525-
#[inline]
526-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
527-
self.to_bytes()
528-
}
529-
530477
#[inline]
531478
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
532479
where
@@ -561,11 +508,6 @@ impl Arg for &ZString {
561508
Ok(Cow::Borrowed(self))
562509
}
563510

564-
#[inline]
565-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
566-
self.to_bytes()
567-
}
568-
569511
#[inline]
570512
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
571513
where
@@ -600,11 +542,6 @@ impl Arg for ZString {
600542
Ok(Cow::Owned(self))
601543
}
602544

603-
#[inline]
604-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
605-
self.as_bytes()
606-
}
607-
608545
#[inline]
609546
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
610547
where
@@ -647,11 +584,6 @@ impl<'a> Arg for Cow<'a, str> {
647584
))
648585
}
649586

650-
#[inline]
651-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
652-
self.as_bytes()
653-
}
654-
655587
#[inline]
656588
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
657589
where
@@ -695,11 +627,6 @@ impl<'a> Arg for Cow<'a, OsStr> {
695627
))
696628
}
697629

698-
#[inline]
699-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
700-
self.as_bytes()
701-
}
702-
703630
#[inline]
704631
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
705632
where
@@ -735,11 +662,6 @@ impl<'a> Arg for Cow<'a, ZStr> {
735662
Ok(self)
736663
}
737664

738-
#[inline]
739-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
740-
self.to_bytes()
741-
}
742-
743665
#[inline]
744666
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
745667
where
@@ -779,11 +701,6 @@ impl<'a> Arg for Component<'a> {
779701
))
780702
}
781703

782-
#[inline]
783-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
784-
self.as_os_str().as_bytes()
785-
}
786-
787704
#[inline]
788705
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
789706
where
@@ -825,11 +742,6 @@ impl<'a> Arg for Components<'a> {
825742
))
826743
}
827744

828-
#[inline]
829-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
830-
self.as_path().as_os_str().as_bytes()
831-
}
832-
833745
#[inline]
834746
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
835747
where
@@ -871,11 +783,6 @@ impl<'a> Arg for Iter<'a> {
871783
))
872784
}
873785

874-
#[inline]
875-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
876-
self.as_path().as_os_str().as_bytes()
877-
}
878-
879786
#[inline]
880787
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
881788
where
@@ -914,11 +821,6 @@ impl Arg for &[u8] {
914821
))
915822
}
916823

917-
#[inline]
918-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
919-
self
920-
}
921-
922824
#[inline]
923825
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
924826
where
@@ -957,11 +859,6 @@ impl Arg for &Vec<u8> {
957859
))
958860
}
959861

960-
#[inline]
961-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
962-
self
963-
}
964-
965862
#[inline]
966863
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
967864
where
@@ -1000,11 +897,6 @@ impl Arg for Vec<u8> {
1000897
))
1001898
}
1002899

1003-
#[inline]
1004-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
1005-
self
1006-
}
1007-
1008900
#[inline]
1009901
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
1010902
where
@@ -1046,11 +938,6 @@ impl Arg for DecInt {
1046938
))
1047939
}
1048940

1049-
#[inline]
1050-
fn as_maybe_utf8_bytes(&self) -> &[u8] {
1051-
self.as_ref().as_os_str().as_bytes()
1052-
}
1053-
1054941
#[inline]
1055942
fn into_with_z_str<T, F>(self, f: F) -> io::Result<T>
1056943
where

0 commit comments

Comments
 (0)