Skip to content

Commit

Permalink
Fix clippy warnings (#5093)
Browse files Browse the repository at this point in the history
## Description

This is a minor PR to fix all the clippy warnings


## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
  • Loading branch information
cr-fuel authored Sep 6, 2023
1 parent 49ee268 commit 7aade9d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
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

0 comments on commit 7aade9d

Please sign in to comment.