fix linting

This commit is contained in:
Léana 江 2025-07-13 17:13:09 +02:00
parent b2c2005888
commit 09519547ea
No known key found for this signature in database
GPG key ID: 4E887A4CA9714ADA
2 changed files with 5 additions and 9 deletions

View file

@ -1,10 +1,9 @@
use super::{AssistKind, AssistsCtx};
use crate::def::ResolveResult;
use crate::{def::AstPtr, TextEdit};
use crate::def::{AstPtr, ResolveResult};
use crate::TextEdit;
use smol_str::ToSmolStr;
use syntax::ast::AstNode;
use syntax::match_ast;
use syntax::{ast, best_token_at_offset};
use syntax::{ast, best_token_at_offset, match_ast};
pub(super) fn inline(ctx: &mut AssistsCtx<'_>) -> Option<()> {
let parse = ctx.db.parse(ctx.frange.file_id);
@ -49,10 +48,7 @@ pub(super) fn inline(ctx: &mut AssistsCtx<'_>) -> Option<()> {
}?;
let replacement_text = {
let node = AstNode::syntax(&replacement);
let do_parenthesize = match &replacement {
ast::Expr::Lambda(_) => true,
_ => false,
};
let do_parenthesize = matches!(&replacement, ast::Expr::Lambda(_));
if do_parenthesize && !parenthesized {
format!("({})", node.text()).to_smolstr()

View file

@ -16,12 +16,12 @@ macro_rules! define_check_assist {
mod add_to_top_level_lambda_param;
mod convert_to_inherit;
mod flatten_attrset;
mod inline;
mod pack_bindings;
mod remove_empty_inherit;
mod remove_empty_let_in;
mod remove_unused_binding;
mod rewrite_string;
mod inline;
use crate::{DefDatabase, FileRange, TextEdit, WorkspaceEdit};
use syntax::ast::{self, AstNode};