mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 05:53:45 +00:00
Replaced adjusted_display_range with it's new version in mismatched_arg_count
This commit is contained in:
parent
38f7a3498e
commit
8f05e7ce55
1 changed files with 7 additions and 7 deletions
|
@ -3,10 +3,10 @@ use hir::InFile;
|
||||||
use ide_db::base_db::FileRange;
|
use ide_db::base_db::FileRange;
|
||||||
use syntax::{
|
use syntax::{
|
||||||
ast::{self, HasArgList},
|
ast::{self, HasArgList},
|
||||||
AstNode, SyntaxNodePtr,
|
AstNode, AstPtr,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{adjusted_display_range, Diagnostic, DiagnosticCode, DiagnosticsContext};
|
use crate::{adjusted_display_range_new, Diagnostic, DiagnosticCode, DiagnosticsContext};
|
||||||
|
|
||||||
// Diagnostic: mismatched-tuple-struct-pat-arg-count
|
// Diagnostic: mismatched-tuple-struct-pat-arg-count
|
||||||
//
|
//
|
||||||
|
@ -24,7 +24,7 @@ pub(crate) fn mismatched_tuple_struct_pat_arg_count(
|
||||||
Diagnostic::new(
|
Diagnostic::new(
|
||||||
DiagnosticCode::RustcHardError("E0023"),
|
DiagnosticCode::RustcHardError("E0023"),
|
||||||
message,
|
message,
|
||||||
invalid_args_range(ctx, d.expr_or_pat.map(Into::into), d.expected, d.found),
|
invalid_args_range(ctx, d.expr_or_pat, d.expected, d.found),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,17 +40,17 @@ pub(crate) fn mismatched_arg_count(
|
||||||
Diagnostic::new(
|
Diagnostic::new(
|
||||||
DiagnosticCode::RustcHardError("E0107"),
|
DiagnosticCode::RustcHardError("E0107"),
|
||||||
message,
|
message,
|
||||||
invalid_args_range(ctx, d.call_expr.map(Into::into), d.expected, d.found),
|
invalid_args_range(ctx, d.call_expr.map(AstPtr::wrap_left), d.expected, d.found),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn invalid_args_range(
|
fn invalid_args_range(
|
||||||
ctx: &DiagnosticsContext<'_>,
|
ctx: &DiagnosticsContext<'_>,
|
||||||
source: InFile<SyntaxNodePtr>,
|
source: InFile<AstPtr<Either<ast::Expr, ast::Pat>>>,
|
||||||
expected: usize,
|
expected: usize,
|
||||||
found: usize,
|
found: usize,
|
||||||
) -> FileRange {
|
) -> FileRange {
|
||||||
adjusted_display_range::<Either<ast::Expr, ast::TupleStructPat>>(ctx, source, &|expr| {
|
adjusted_display_range_new(ctx, source, &|expr| {
|
||||||
let (text_range, r_paren_token, expected_arg) = match expr {
|
let (text_range, r_paren_token, expected_arg) = match expr {
|
||||||
Either::Left(ast::Expr::CallExpr(call)) => {
|
Either::Left(ast::Expr::CallExpr(call)) => {
|
||||||
let arg_list = call.arg_list()?;
|
let arg_list = call.arg_list()?;
|
||||||
|
@ -68,7 +68,7 @@ fn invalid_args_range(
|
||||||
arg_list.args().nth(expected).map(|it| it.syntax().text_range()),
|
arg_list.args().nth(expected).map(|it| it.syntax().text_range()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Either::Right(pat) => {
|
Either::Right(ast::Pat::TupleStructPat(pat)) => {
|
||||||
let r_paren = pat.r_paren_token()?;
|
let r_paren = pat.r_paren_token()?;
|
||||||
let l_paren = pat.l_paren_token()?;
|
let l_paren = pat.l_paren_token()?;
|
||||||
(
|
(
|
||||||
|
|
Loading…
Reference in a new issue