fn add_suggestion_for_duplicate_nested_use(
        &self,
        err: &mut DiagnosticBuilder<'_>,
        import: &Import<'_>,
        binding_span: Span,
    ) {
        assert!(import.is_nested());
        let message = "remove unnecessary import";

        // Two examples will be used to illustrate the span manipulations we're doing:
        //
        // - Given `use issue_52891::{d, a, e};` where `a` is a duplicate then `binding_span` is
        //   `a` and `import.use_span` is `issue_52891::{d, a, e};`.
        // - Given `use issue_52891::{d, e, a};` where `a` is a duplicate then `binding_span` is
        //   `a` and `import.use_span` is `issue_52891::{d, e, a};`.

        let (found_closing_brace, span) =
            find_span_of_binding_until_next_binding(self.session, binding_span, import.use_span);

        // If there was a closing brace then identify the span to remove any trailing commas from
        // previous imports.
        if found_closing_brace {
            if let Some(span) = extend_span_to_previous_binding(self.session, span) {
                err.tool_only_span_suggestion(
                    span,
                    message,
                    String::new(),
                    Applicability::MaybeIncorrect,
                );
            } else {
                // Remove the entire line if we cannot extend the span back, this indicates a
                // `issue_52891::{self}` case.
                err.span_suggestion(
                    import.use_span_with_attributes,
                    message,
                    String::new(),
                    Applicability::MaybeIncorrect,
                );
            }

            return;
        }

        err.span_suggestion(span, message, String::new(), Applicability::MachineApplicable);
    }
/// This function adds a suggestion to remove a unnecessary binding from an import that is
/// nested. In the following example, this function will be invoked to remove the `a` binding
/// in the second use statement:
///
/// ```ignore (diagnostic)
/// use issue_52891::a;
/// use issue_52891::{d, a, e};
/// ```
///
/// The following suggestion will be added:
///
/// ```ignore (diagnostic)
/// use issue_52891::{d, a, e};
///                      ^-- help: remove unnecessary import
/// ```
///
/// If the nested use contains only one import then the suggestion will remove the entire
/// line.
///
/// It is expected that the provided import is nested - this isn't checked by the
/// function. If this invariant is not upheld, this function's behaviour will be unexpected
/// as characters expected by span manipulations won't be present.
This function adds a suggestion to remove a unnecessary binding from an import that is
nested. In the following example, this function will be invoked to remove the `a` binding
in the second use statement.



The following suggestion will be added.



If the nested use contains only one import then the suggestion will remove the entire
line.

It is expected that the provided import is nested - this isn't checked by the
function. If this invariant is not upheld, this function's behaviour will be unexpected
as characters expected by span manipulations won't be present.
This function adds a suggestion to remove a unnecessary binding from an import that is nested . In the following example this function will be invoked to remove the ` a ` binding in the second use statement . The following suggestion will be added . If the nested use contains only one import then the suggestion will remove the entire line . It is expected that the provided import is nested - this isn ' t checked by the function . If this invariant is not upheld this function ' s behaviour will be unexpected as characters expected by span manipulations won ' t be present .
fn add_suggestion_for_duplicate_nested_use(
        &self,
        err: &mut DiagnosticBuilder<'_>,
        import: &Import<'_>,
        binding_span: Span,
    ) {
        assert!(import.is_nested());
        let message = "remove unnecessary import";
        // Two examples will be used to illustrate the span manipulations we're doing:
        //
        // - Given `use issue_52891::{d, a, e};` where `a` is a duplicate then `binding_span` is
        //   `a` and `import.use_span` is `issue_52891::{d, a, e};`.
        // - Given `use issue_52891::{d, e, a};` where `a` is a duplicate then `binding_span` is
        //   `a` and `import.use_span` is `issue_52891::{d, e, a};`.
        let (found_closing_brace, span) =
            find_span_of_binding_until_next_binding(self.session, binding_span, import.use_span);
        // If there was a closing brace then identify the span to remove any trailing commas from
        // previous imports.
        if found_closing_brace {
            if let Some(span) = extend_span_to_previous_binding(self.session, span) {
                err.tool_only_span_suggestion(
                    span,
                    message,
                    String::new(),
                    Applicability::MaybeIncorrect,
                );
            } else {
                // Remove the entire line if we cannot extend the span back, this indicates a
                // `issue_52891::{self}` case.
                err.span_suggestion(
                    import.use_span_with_attributes,
                    message,
                    String::new(),
                    Applicability::MaybeIncorrect,
                );
            }
            return;
        }
        err.span_suggestion(span, message, String::new(), Applicability::MachineApplicable);
    }
fn add_suggestion_for_duplicate_nested_use ( & self , err : & mut DiagnosticBuilder < ' _ > , import : & Import < ' _ > , binding_span : Span , ) { assert ! ( import is_nested ( ) ) ; let message = " " ; // Two examples will be used to illustrate the span manipulations we're doing: // // - Given `use issue_52891::{d, a, e};` where `a` is a duplicate then `binding_span` is //   `a` and `import.use_span` is `issue_52891::{d, a, e};`. // - Given `use issue_52891::{d, e, a};` where `a` is a duplicate then `binding_span` is //   `a` and `import.use_span` is `issue_52891::{d, e, a};`. let ( found_closing_brace , span ) = find_span_of_binding_until_next_binding ( self . session , binding_span , import . use_span ) ; // If there was a closing brace then identify the span to remove any trailing commas from // previous imports. if found_closing_brace { if let Some ( span ) = extend_span_to_previous_binding ( self . session , span ) { err . tool_only_span_suggestion ( span , message , String :: new ( ) , Applicability :: MaybeIncorrect , ) ; } else { // Remove the entire line if we cannot extend the span back, this indicates a // `issue_52891::{self}` case. err . span_suggestion ( import . use_span_with_attributes , message , String :: new ( ) , Applicability :: MaybeIncorrect , ) ; } return ; } err . span_suggestion ( span , message , String :: new ( ) , Applicability :: MachineApplicable ) ; }
This function adds a suggestion to remove a unnecessary binding from an import that is
nested.
This function adds a suggestion to remove a unnecessary binding from an import that is nested .
&self
err
&mut DiagnosticBuilder<'_>
import
&Import<'_>
binding_span
Span
&self
err
&mut DiagnosticBuilder<'_>
import
&Import<'_>
binding_span
Span