Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy warnings #5093

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sway-lsp/src/capabilities/hover/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub fn hover_data(
}
// The `TypeInfo` of the token does not contain an `Ident`. In this case,
// we use the `Ident` of the token itself.
None => (ident.clone(), token),
None => (ident, token),
};

let contents = hover_format(session.clone(), &engines, &decl_token, &decl_ident.name);
Expand Down
2 changes: 1 addition & 1 deletion sway-lsp/src/core/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl TokenIdent {
.source_id()
.map(|source_id| se.get_path(source_id));
Self {
name: ident.span().clone().str(),
name: ident.span().str(),
range: get_range_from_span(&ident.span()),
path,
is_raw_ident: ident.is_raw_ident(),
Expand Down
5 changes: 3 additions & 2 deletions sway-lsp/src/core/token_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,12 @@ impl TokenMap {
Some(TypedAstToken::TypedFunctionDeclaration(decl))
if functions_only == Some(true) =>
{
TokenIdent::new(&Ident::new(decl.span.clone()), source_engine)
TokenIdent::new(&Ident::new(decl.span), source_engine)
}
Some(TypedAstToken::TypedDeclaration(decl)) => {
TokenIdent::new(&Ident::new(decl.span().clone()), source_engine)
TokenIdent::new(&Ident::new(decl.span()), source_engine)
}
#[allow(clippy::redundant_clone)]
_ => ident.clone(),
};
if position >= token_ident.range.start && position <= token_ident.range.end {
Expand Down
8 changes: 4 additions & 4 deletions sway-lsp/src/traverse/typed_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ fn collect_type_id(
let decl = ctx.engines.de().get_enum(decl_ref);
if let Some(token) = ctx
.tokens
.try_get_mut(&ctx.ident(&Ident::new(type_span.clone())))
.try_get_mut(&ctx.ident(&Ident::new(type_span)))
.try_unwrap()
{
assign_type_to_token(token, symbol_kind, typed_token.clone(), type_id);
Expand All @@ -1231,7 +1231,7 @@ fn collect_type_id(
let decl = ctx.engines.de().get_struct(decl_ref);
if let Some(token) = ctx
.tokens
.try_get_mut(&ctx.ident(&Ident::new(type_span.clone())))
.try_get_mut(&ctx.ident(&Ident::new(type_span)))
.try_unwrap()
{
assign_type_to_token(token, symbol_kind, typed_token.clone(), type_id);
Expand All @@ -1254,7 +1254,7 @@ fn collect_type_id(
} => {
if let Some(token) = ctx
.tokens
.try_get_mut(&ctx.ident(&Ident::new(name.span().clone())))
.try_get_mut(&ctx.ident(&Ident::new(name.span())))
.try_unwrap()
{
assign_type_to_token(token, symbol_kind, typed_token.clone(), type_id);
Expand All @@ -1273,7 +1273,7 @@ fn collect_type_id(
_ => {
if let Some(token) = ctx
.tokens
.try_get_mut(&ctx.ident(&Ident::new(type_span.clone())))
.try_get_mut(&ctx.ident(&Ident::new(type_span)))
.try_unwrap()
{
assign_type_to_token(token, symbol_kind, typed_token.clone(), type_id);
Expand Down
Loading