mirror of
https://github.com/oxalica/nil.git
synced 2025-12-23 09:19:49 +00:00
fix linting
This commit is contained in:
parent
b2c2005888
commit
09519547ea
2 changed files with 5 additions and 9 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue