Fix some clippy lints
This commit is contained in:
parent
8ad7c0439c
commit
6c799dac1e
@ -96,8 +96,7 @@ fn line_to_block(acc: &mut Assists, comment: ast::Comment) -> Option<()> {
|
||||
let block_prefix =
|
||||
CommentKind { shape: CommentShape::Block, ..comment.kind() }.prefix();
|
||||
|
||||
let output =
|
||||
format!("{}\n{}\n{}*/", block_prefix, block_comment_body, indentation.to_string());
|
||||
let output = format!("{}\n{}\n{}*/", block_prefix, block_comment_body, indentation);
|
||||
|
||||
edit.replace(target, output)
|
||||
},
|
||||
|
@ -91,10 +91,7 @@ pub(crate) fn convert_into_to_from(acc: &mut Assists, ctx: &AssistContext) -> Op
|
||||
builder.replace(src_type.syntax().text_range(), dest_type.to_string());
|
||||
builder.replace(ast_trait.syntax().text_range(), format!("From<{}>", src_type));
|
||||
builder.replace(into_fn_return.syntax().text_range(), "-> Self");
|
||||
builder.replace(
|
||||
into_fn_params.syntax().text_range(),
|
||||
format!("(val: {})", src_type.to_string()),
|
||||
);
|
||||
builder.replace(into_fn_params.syntax().text_range(), format!("(val: {})", src_type));
|
||||
builder.replace(into_fn_name.syntax().text_range(), "from");
|
||||
|
||||
for s in selfs {
|
||||
|
@ -174,7 +174,7 @@ fn edit_tuple_assignment(
|
||||
|
||||
// with sub_pattern: keep original tuple and add subpattern: `tup @ (_0, _1)`
|
||||
if in_sub_pattern {
|
||||
let text = format!(" @ {}", tuple_pat.to_string());
|
||||
let text = format!(" @ {}", tuple_pat);
|
||||
match ctx.config.snippet_cap {
|
||||
Some(cap) => {
|
||||
let snip = add_cursor(&text);
|
||||
|
@ -298,7 +298,7 @@ impl Module {
|
||||
if let Some(name_ref) = ast::NameRef::cast(desc) {
|
||||
return Some((
|
||||
name_ref.syntax().text_range(),
|
||||
format!("{}::{}", self.name, name_ref.to_string()),
|
||||
format!("{}::{}", self.name, name_ref),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -59,9 +59,8 @@ pub(crate) fn generate_documentation_template(
|
||||
"Generate a documentation template",
|
||||
text_range,
|
||||
|builder| {
|
||||
let mut doc_lines = Vec::new();
|
||||
// Introduction / short function description before the sections
|
||||
doc_lines.push(introduction_builder(&ast_func, ctx));
|
||||
let mut doc_lines = vec![introduction_builder(&ast_func, ctx)];
|
||||
// Then come the sections
|
||||
if let Some(mut lines) = examples_builder(&ast_func, ctx) {
|
||||
doc_lines.push("".into());
|
||||
@ -303,7 +302,7 @@ fn arguments_from_params(param_list: &ast::ParamList) -> String {
|
||||
// instance `TuplePat`) could be managed later.
|
||||
Some(ast::Pat::IdentPat(ident_pat)) => match ident_pat.name() {
|
||||
Some(name) => match is_a_ref_mut_param(¶m) {
|
||||
true => format!("&mut {}", name.to_string()),
|
||||
true => format!("&mut {}", name),
|
||||
false => name.to_string(),
|
||||
},
|
||||
None => "_".to_string(),
|
||||
|
@ -121,7 +121,7 @@ impl QualifyCandidate<'_> {
|
||||
}
|
||||
QualifyCandidate::UnqualifiedName(generics) => {
|
||||
let generics = generics.as_ref().map_or_else(String::new, ToString::to_string);
|
||||
replacer(format!("{}{}", import.to_string(), generics));
|
||||
replacer(format!("{}{}", import, generics));
|
||||
}
|
||||
QualifyCandidate::TraitAssocItem(qualifier, segment) => {
|
||||
replacer(format!("<{} as {}>::{}", qualifier, import, segment));
|
||||
|
@ -431,7 +431,7 @@ fn generate_impl_text_inner(adt: &ast::Adt, trait_text: Option<&str>, code: &str
|
||||
buf.push_str("\n\n");
|
||||
adt.attrs()
|
||||
.filter(|attr| attr.as_simple_call().map(|(name, _arg)| name == "cfg").unwrap_or(false))
|
||||
.for_each(|attr| buf.push_str(format!("{}\n", attr.to_string()).as_str()));
|
||||
.for_each(|attr| buf.push_str(format!("{}\n", attr).as_str()));
|
||||
buf.push_str("impl");
|
||||
if let Some(generic_params) = &generic_params {
|
||||
let lifetimes = generic_params.lifetime_params().map(|lt| format!("{}", lt.syntax()));
|
||||
|
@ -147,7 +147,7 @@ impl Fixture {
|
||||
if line.starts_with("// ")
|
||||
&& line.contains(':')
|
||||
&& !line.contains("::")
|
||||
&& !line.contains(".")
|
||||
&& !line.contains('.')
|
||||
&& line.chars().all(|it| !it.is_uppercase())
|
||||
{
|
||||
panic!("looks like invalid metadata line: {:?}", line);
|
||||
|
Loading…
x
Reference in New Issue
Block a user