@@ -122,7 +122,7 @@ fn is_prohibited_bidirectional_text(s: &str) -> bool {
122
122
/// Nameprep is defined in [RFC 3491][].
123
123
///
124
124
/// [RFC 3491]: https://tools.ietf.org/html/rfc3491
125
- pub fn nameprep ( s : & str ) -> Result < Cow < ' _ , str > , Error > {
125
+ pub fn nameprep ( s : & str ) -> Result < String , Error > {
126
126
// 3. Mapping
127
127
let mapped = s. chars ( )
128
128
. filter ( |& c| !tables:: commonly_mapped_to_nothing ( c) )
@@ -162,15 +162,15 @@ pub fn nameprep(s: &str) -> Result<Cow<'_, str>, Error> {
162
162
return Err ( Error ( ErrorCause :: ProhibitedCharacter ( c) ) ) ;
163
163
}
164
164
165
- Ok ( Cow :: Owned ( normalized) )
165
+ Ok ( normalized)
166
166
}
167
167
168
168
/// Prepares a string with the Nodeprep profile of the stringprep algorithm.
169
169
///
170
170
/// Nameprep is defined in [RFC 3920, Appendix A][].
171
171
///
172
172
/// [RFC 3920, Appendix A]: https://tools.ietf.org/html/rfc3920#appendix-A
173
- pub fn nodeprep ( s : & str ) -> Result < Cow < ' _ , str > , Error > {
173
+ pub fn nodeprep ( s : & str ) -> Result < String , Error > {
174
174
// A.3. Mapping
175
175
let mapped = s. chars ( )
176
176
. filter ( |& c| !tables:: commonly_mapped_to_nothing ( c) )
@@ -212,7 +212,7 @@ pub fn nodeprep(s: &str) -> Result<Cow<'_, str>, Error> {
212
212
return Err ( Error ( ErrorCause :: ProhibitedCharacter ( c) ) ) ;
213
213
}
214
214
215
- Ok ( Cow :: Owned ( normalized) )
215
+ Ok ( normalized)
216
216
}
217
217
218
218
// Additional characters not allowed in JID nodes, by RFC3920.
@@ -228,7 +228,7 @@ fn prohibited_node_character(c: char) -> bool {
228
228
/// Nameprep is defined in [RFC 3920, Appendix B][].
229
229
///
230
230
/// [RFC 3920, Appendix B]: https://tools.ietf.org/html/rfc3920#appendix-B
231
- pub fn resourceprep ( s : & str ) -> Result < Cow < ' _ , str > , Error > {
231
+ pub fn resourceprep ( s : & str ) -> Result < String , Error > {
232
232
// B.3. Mapping
233
233
let mapped = s. chars ( )
234
234
. filter ( |& c| !tables:: commonly_mapped_to_nothing ( c) )
@@ -268,7 +268,7 @@ pub fn resourceprep(s: &str) -> Result<Cow<'_, str>, Error> {
268
268
return Err ( Error ( ErrorCause :: ProhibitedCharacter ( c) ) ) ;
269
269
}
270
270
271
- Ok ( Cow :: Owned ( normalized) )
271
+ Ok ( normalized)
272
272
}
273
273
274
274
#[ cfg( test) ]
0 commit comments