Skip to content

Commit f700ca8

Browse files
committed
Address clippy lints
1 parent b05732b commit f700ca8

File tree

1 file changed

+69
-68
lines changed

1 file changed

+69
-68
lines changed

idna/src/uts46.rs

Lines changed: 69 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -515,14 +515,14 @@ impl Uts46 {
515515
/// # Arguments
516516
///
517517
/// * `domain_name` - The input domain name as UTF-8 bytes. (The UTF-8ness is checked by
518-
/// this method and input that is not well-formed UTF-8 is treated as an error. If you
519-
/// already have a `&str`, call `.as_bytes()` on it.)
518+
/// this method and input that is not well-formed UTF-8 is treated as an error. If you
519+
/// already have a `&str`, call `.as_bytes()` on it.)
520520
/// * `ascii_deny_list` - What ASCII deny list, if any, to apply. The UTS 46
521-
/// _UseSTD3ASCIIRules_ flag or the WHATWG URL Standard forbidden domain code point
522-
/// processing is handled via this argument. Most callers are probably the best off
523-
/// by using [`AsciiDenyList::URL`] here.
521+
/// _UseSTD3ASCIIRules_ flag or the WHATWG URL Standard forbidden domain code point
522+
/// processing is handled via this argument. Most callers are probably the best off
523+
/// by using [`AsciiDenyList::URL`] here.
524524
/// * `hyphens` - The UTS 46 _CheckHyphens_ flag. Most callers are probably the best
525-
/// off by using [`Hyphens::Allow`] here.
525+
/// off by using [`Hyphens::Allow`] here.
526526
/// * `dns_length` - The UTS 46 _VerifyDNSLength_ flag.
527527
pub fn to_ascii<'a>(
528528
&self,
@@ -581,14 +581,14 @@ impl Uts46 {
581581
/// # Arguments
582582
///
583583
/// * `domain_name` - The input domain name as UTF-8 bytes. (The UTF-8ness is checked by
584-
/// this method and input that is not well-formed UTF-8 is treated as an error. If you
585-
/// already have a `&str`, call `.as_bytes()` on it.)
584+
/// this method and input that is not well-formed UTF-8 is treated as an error. If you
585+
/// already have a `&str`, call `.as_bytes()` on it.)
586586
/// * `ascii_deny_list` - What ASCII deny list, if any, to apply. The UTS 46
587-
/// _UseSTD3ASCIIRules_ flag or the WHATWG URL Standard forbidden domain code point
588-
/// processing is handled via this argument. Most callers are probably the best off
589-
/// by using [`AsciiDenyList::URL`] here.
587+
/// _UseSTD3ASCIIRules_ flag or the WHATWG URL Standard forbidden domain code point
588+
/// processing is handled via this argument. Most callers are probably the best off
589+
/// by using [`AsciiDenyList::URL`] here.
590590
/// * `hyphens` - The UTS 46 _CheckHyphens_ flag. Most callers are probably the best
591-
/// off by using [`Hyphens::Allow`] here.
591+
/// off by using [`Hyphens::Allow`] here.
592592
pub fn to_unicode<'a>(
593593
&self,
594594
domain_name: &'a [u8],
@@ -627,23 +627,23 @@ impl Uts46 {
627627
/// # Arguments
628628
///
629629
/// * `domain_name` - The input domain name as UTF-8 bytes. (The UTF-8ness is checked by
630-
/// this method and input that is not well-formed UTF-8 is treated as an error. If you
631-
/// already have a `&str`, call `.as_bytes()` on it.)
630+
/// this method and input that is not well-formed UTF-8 is treated as an error. If you
631+
/// already have a `&str`, call `.as_bytes()` on it.)
632632
/// * `ascii_deny_list` - What ASCII deny list, if any, to apply. The UTS 46
633-
/// _UseSTD3ASCIIRules_ flag or the WHATWG URL Standard forbidden domain code point
634-
/// processing is handled via this argument. Most callers are probably the best off
635-
/// by using [`AsciiDenyList::URL`] here.
633+
/// _UseSTD3ASCIIRules_ flag or the WHATWG URL Standard forbidden domain code point
634+
/// processing is handled via this argument. Most callers are probably the best off
635+
/// by using [`AsciiDenyList::URL`] here.
636636
/// * `hyphens` - The UTS 46 _CheckHyphens_ flag. Most callers are probably the best
637-
/// off by using [`Hyphens::Allow`] here.
637+
/// off by using [`Hyphens::Allow`] here.
638638
/// * `output_as_unicode` - A closure for deciding if a label should be output as Unicode
639-
/// (as opposed to Punycode). The first argument is the label for which a decision is
640-
/// needed (always non-empty slice). The second argument is the TLD (potentially empty).
641-
/// The third argument is `true` iff the domain name as a whole is a bidi domain name.
642-
/// Only non-erroneous labels that contain at least one non-ASCII character are passed
643-
/// to the closure as the first argument. The second and third argument values are
644-
/// guaranteed to remain the same during a single call to `process`, and the closure
645-
/// may cache computations derived from the second and third argument (hence the
646-
/// `FnMut` type).
639+
/// (as opposed to Punycode). The first argument is the label for which a decision is
640+
/// needed (always non-empty slice). The second argument is the TLD (potentially empty).
641+
/// The third argument is `true` iff the domain name as a whole is a bidi domain name.
642+
/// Only non-erroneous labels that contain at least one non-ASCII character are passed
643+
/// to the closure as the first argument. The second and third argument values are
644+
/// guaranteed to remain the same during a single call to `process`, and the closure
645+
/// may cache computations derived from the second and third argument (hence the
646+
/// `FnMut` type).
647647
pub fn to_user_interface<'a, OutputUnicode: FnMut(&[char], &[char], bool) -> bool>(
648648
&self,
649649
domain_name: &'a [u8],
@@ -679,59 +679,59 @@ impl Uts46 {
679679
/// # Arguments
680680
///
681681
/// * `domain_name` - The input domain name as UTF-8 bytes. (The UTF-8ness is checked by
682-
/// this method and input that is not well-formed UTF-8 is treated as an error. If you
683-
/// already have a `&str`, call `.as_bytes()` on it.)
682+
/// this method and input that is not well-formed UTF-8 is treated as an error. If you
683+
/// already have a `&str`, call `.as_bytes()` on it.)
684684
/// * `ascii_deny_list` - What ASCII deny list, if any, to apply. The UTS 46
685-
/// _UseSTD3ASCIIRules_ flag or the WHATWG URL Standard forbidden domain code point
686-
/// processing is handled via this argument. Most callers are probably the best off
687-
/// by using [`AsciiDenyList::URL`] here.
685+
/// _UseSTD3ASCIIRules_ flag or the WHATWG URL Standard forbidden domain code point
686+
/// processing is handled via this argument. Most callers are probably the best off
687+
/// by using [`AsciiDenyList::URL`] here.
688688
/// * `hyphens` - The UTS 46 _CheckHyphens_ flag. Most callers are probably the best
689-
/// off by using [`Hyphens::Allow`] here.
689+
/// off by using [`Hyphens::Allow`] here.
690690
/// * `error_policy` - Whether to fail fast or to produce output that may be rendered
691-
/// for the user to examine in case of errors.
691+
/// for the user to examine in case of errors.
692692
/// * `output_as_unicode` - A closure for deciding if a label should be output as Unicode
693-
/// (as opposed to Punycode). The first argument is the label for which a decision is
694-
/// needed (always non-empty slice). The second argument is the TLD (potentially empty).
695-
/// The third argument is `true` iff the domain name as a whole is a bidi domain name.
696-
/// Only non-erroneous labels that contain at least one non-ASCII character are passed
697-
/// to the closure as the first argument. The second and third argument values are
698-
/// guaranteed to remain the same during a single call to `process`, and the closure
699-
/// may cache computations derived from the second and third argument (hence the
700-
/// `FnMut` type). To perform the _ToASCII_ operation, `|_, _, _| false` must be
701-
/// passed as the closure. To perform the _ToUnicode_ operation, `|_, _, _| true` must
702-
/// be passed as the closure. A more complex closure may be used to prepare a domain
703-
/// name for display in a user interface so that labels are converted to the Unicode
704-
/// form in general but potentially misleading labels are converted to the Punycode
705-
/// form.
706-
/// `sink` - The object that receives the output (in the non-passthrough case).
707-
/// `ascii_sink` - A second sink that receives the _ToASCII_ form only if there
708-
/// were no errors and `sink` received at least one character of non-ASCII output.
709-
/// The purpose of this argument is to enable a user interface display form of the
710-
/// domain and the _ToASCII_ form of the domain to be computed efficiently together.
711-
/// This argument is useless when `output_as_unicode` always returns `false`, in
712-
/// which case the _ToASCII_ form ends up in `sink` already. If `ascii_sink` receives
713-
/// no output and the return value is `Ok(ProcessingSuccess::WroteToSink)`, use the
714-
/// output received by `sink` also as the _ToASCII_ result.
693+
/// (as opposed to Punycode). The first argument is the label for which a decision is
694+
/// needed (always non-empty slice). The second argument is the TLD (potentially empty).
695+
/// The third argument is `true` iff the domain name as a whole is a bidi domain name.
696+
/// Only non-erroneous labels that contain at least one non-ASCII character are passed
697+
/// to the closure as the first argument. The second and third argument values are
698+
/// guaranteed to remain the same during a single call to `process`, and the closure
699+
/// may cache computations derived from the second and third argument (hence the
700+
/// `FnMut` type). To perform the _ToASCII_ operation, `|_, _, _| false` must be
701+
/// passed as the closure. To perform the _ToUnicode_ operation, `|_, _, _| true` must
702+
/// be passed as the closure. A more complex closure may be used to prepare a domain
703+
/// name for display in a user interface so that labels are converted to the Unicode
704+
/// form in general but potentially misleading labels are converted to the Punycode
705+
/// form.
706+
/// * `sink` - The object that receives the output (in the non-passthrough case).
707+
/// * `ascii_sink` - A second sink that receives the _ToASCII_ form only if there
708+
/// were no errors and `sink` received at least one character of non-ASCII output.
709+
/// The purpose of this argument is to enable a user interface display form of the
710+
/// domain and the _ToASCII_ form of the domain to be computed efficiently together.
711+
/// This argument is useless when `output_as_unicode` always returns `false`, in
712+
/// which case the _ToASCII_ form ends up in `sink` already. If `ascii_sink` receives
713+
/// no output and the return value is `Ok(ProcessingSuccess::WroteToSink)`, use the
714+
/// output received by `sink` also as the _ToASCII_ result.
715715
///
716716
/// # Return value
717717
///
718718
/// * `Ok(ProcessingSuccess::Passthrough)` - The caller must treat
719-
/// `unsafe { core::str::from_utf8_unchecked(domain_name) }` as the output. (This
720-
/// return value asserts that calling `core::str::from_utf8_unchecked(domain_name)`
721-
/// is safe.)
719+
/// `unsafe { core::str::from_utf8_unchecked(domain_name) }` as the output. (This
720+
/// return value asserts that calling `core::str::from_utf8_unchecked(domain_name)`
721+
/// is safe.)
722722
/// * `Ok(ProcessingSuccess::WroteToSink)` - The caller must treat was was written
723-
/// to `sink` as the output. If another sink was passed as `ascii_sink` but it did
724-
/// not receive output, the caller must treat what was written to `sink` also as
725-
/// the _ToASCII_ output. Otherwise, if `ascii_sink` received output, the caller
726-
/// must treat what was written to `ascii_sink` as the _ToASCII_ output.
723+
/// to `sink` as the output. If another sink was passed as `ascii_sink` but it did
724+
/// not receive output, the caller must treat what was written to `sink` also as
725+
/// the _ToASCII_ output. Otherwise, if `ascii_sink` received output, the caller
726+
/// must treat what was written to `ascii_sink` as the _ToASCII_ output.
727727
/// * `Err(ProcessingError::ValidityError)` - The input was in error and must
728-
/// not be used for DNS lookup or otherwise in a network protocol. If `error_policy`
729-
/// was `ErrorPolicy::MarkErrors`, the output written to `sink` may be displayed
730-
/// to the user as an illustration of where the error was or the errors were.
728+
/// not be used for DNS lookup or otherwise in a network protocol. If `error_policy`
729+
/// was `ErrorPolicy::MarkErrors`, the output written to `sink` may be displayed
730+
/// to the user as an illustration of where the error was or the errors were.
731731
/// * `Err(ProcessingError::SinkError)` - Either `sink` or `ascii_sink` returned
732-
/// [`core::fmt::Error`]. The partial output written to `sink` `ascii_sink` must not
733-
/// be used. If `W` never returns [`core::fmt::Error`], this method never returns
734-
/// `Err(ProcessingError::SinkError)`.
732+
/// [`core::fmt::Error`]. The partial output written to `sink` `ascii_sink` must not
733+
/// be used. If `W` never returns [`core::fmt::Error`], this method never returns
734+
/// `Err(ProcessingError::SinkError)`.
735735
///
736736
/// # Safety-usable invariant
737737
///
@@ -1070,6 +1070,7 @@ impl Uts46 {
10701070
/// can avoid monomorphizing in the interest of code size.
10711071
/// Separating this into a different stack frame compared to `process_inner`
10721072
/// improves performance in the ICU4X case.
1073+
#[allow(clippy::too_many_arguments)]
10731074
#[inline(never)]
10741075
fn process_innermost<'a>(
10751076
&self,

0 commit comments

Comments
 (0)