Skip to content

Commit 90b6230

Browse files
fix: appease clippy
Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
1 parent ee367d8 commit 90b6230

14 files changed

Lines changed: 23 additions & 51 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Start from a rust base image
2-
FROM rust:1.81.0 as base
2+
FROM rust:1.83.0 as base
33

44
# Set the current directory
55
WORKDIR /app

Makefile.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ skip_core_tasks = true
44

55
[tasks.deps-wasm]
66
script = '''
7-
cargo install wasm-bindgen-cli
7+
cargo install -f wasm-bindgen-cli --version 0.2.99
88
'''
99

1010
[tasks.deps-npm]

crates/backend/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async fn main() -> std::io::Result<()> {
5959
.add(("Cross-Origin-Opener-Policy", "same-origin"))
6060
.add(("Cross-Origin-Embedder-Policy", "require-corp")),
6161
)
62-
.route("/compile", post().to(|body| route_compile(body)));
62+
.route("/compile", post().to(route_compile));
6363

6464
// Serve frontend files if configured via CLI
6565
match frontend_folder {

crates/browser/tests/server_tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ mod tests {
1313

1414
use super::*;
1515

16-
const INITIALIZE_REQUEST: &'static str = r#"{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"processId":null,"clientInfo":{"name":"demo-language-client"},"capabilities":{},"rootUri":null}}"#;
17-
const INITIALIZE_EXPECTED_RESPONSE: &'static str = r#"{"jsonrpc":"2.0","result":{"capabilities":{"completionProvider":{"resolveProvider":false,"triggerCharacters":["."]},"declarationProvider":true,"definitionProvider":true,"documentFormattingProvider":true,"executeCommandProvider":{"commands":[]},"hoverProvider":true,"implementationProvider":true,"referencesProvider":true,"renameProvider":true,"signatureHelpProvider":{},"textDocumentSync":2,"typeDefinitionProvider":true,"workspace":{"workspaceFolders":{"changeNotifications":true,"supported":true}},"workspaceSymbolProvider":true}},"id":1}"#;
16+
const INITIALIZE_REQUEST: &str = r#"{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"processId":null,"clientInfo":{"name":"demo-language-client"},"capabilities":{},"rootUri":null}}"#;
17+
const INITIALIZE_EXPECTED_RESPONSE: &str = r#"{"jsonrpc":"2.0","result":{"capabilities":{"completionProvider":{"resolveProvider":false,"triggerCharacters":["."]},"declarationProvider":true,"definitionProvider":true,"documentFormattingProvider":true,"executeCommandProvider":{"commands":[]},"hoverProvider":true,"implementationProvider":true,"referencesProvider":true,"renameProvider":true,"signatureHelpProvider":{},"textDocumentSync":2,"typeDefinitionProvider":true,"workspace":{"workspaceFolders":{"changeNotifications":true,"supported":true}},"workspaceSymbolProvider":true}},"id":1}"#;
1818

1919
const INITALIZED: &str = r#"{"jsonrpc":"2.0","method":"initialized","params":{}}"#;
2020

21-
const TEXTDOCUMENT_DIDOPEN: &'static str = r#" {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"inmemory://demo.js","languageId":"solidity","version":0,"text":" // SPDX-License-Identifier: MIT\n pragma solidity >=0.6.12 <0.9.0;\n contract HelloWorld {\n /**\n * @dev Prints Hello World string\n */\n function print() public pure returns (string memory) {\n return \"Hello World!\";\n }\n }\n"}}}"#;
21+
const TEXTDOCUMENT_DIDOPEN: &str = r#" {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"inmemory://demo.js","languageId":"solidity","version":0,"text":" // SPDX-License-Identifier: MIT\n pragma solidity >=0.6.12 <0.9.0;\n contract HelloWorld {\n /**\n * @dev Prints Hello World string\n */\n function print() public pure returns (string memory) {\n return \"Hello World!\";\n }\n }\n"}}}"#;
2222

2323
const DIAGNOSTIC_REQUEST: &str = r#"{"jsonrpc":"2.0","id":3,"method":"textDocument/diagnostic","params":{"textDocument":{"uri":"inmemory://demo.js","languageId":"solidity","version":0,"text":" // SPDX-License-Identifier: MIT\n pragma solidity >=0.6.12 <0.9.0;\n contract HelloWorld {\n /**\n * @dev Prints Hello World string\n */\n function print() public pure returns (string memory) {\n return \"Hello World!\";\n }\n }\n"}}}"#;
2424

crates/solang/solang-parser/src/helpers/loc.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@ impl<T: CodeLocation> OptionalCodeLocation for Vec<T> {
4545
}
4646
}
4747

48-
impl<'a, T: ?Sized + OptionalCodeLocation> OptionalCodeLocation for &'a T {
48+
impl<T: ?Sized + OptionalCodeLocation> OptionalCodeLocation for &T {
4949
fn loc_opt(&self) -> Option<Loc> {
5050
(**self).loc_opt()
5151
}
5252
}
5353

54-
impl<'a, T: ?Sized + OptionalCodeLocation> OptionalCodeLocation for &'a mut T {
54+
impl<T: ?Sized + OptionalCodeLocation> OptionalCodeLocation for &mut T {
5555
fn loc_opt(&self) -> Option<Loc> {
5656
(**self).loc_opt()
5757
}
5858
}
5959

60-
impl<'a, T: ?Sized + ToOwned + OptionalCodeLocation> OptionalCodeLocation for Cow<'a, T> {
60+
impl<T: ?Sized + ToOwned + OptionalCodeLocation> OptionalCodeLocation for Cow<'_, T> {
6161
fn loc_opt(&self) -> Option<Loc> {
6262
(**self).loc_opt()
6363
}
@@ -160,19 +160,19 @@ impl CodeLocation for Loc {
160160
}
161161
}
162162

163-
impl<'a, T: ?Sized + CodeLocation> CodeLocation for &'a T {
163+
impl<T: ?Sized + CodeLocation> CodeLocation for &T {
164164
fn loc(&self) -> Loc {
165165
(**self).loc()
166166
}
167167
}
168168

169-
impl<'a, T: ?Sized + CodeLocation> CodeLocation for &'a mut T {
169+
impl<T: ?Sized + CodeLocation> CodeLocation for &mut T {
170170
fn loc(&self) -> Loc {
171171
(**self).loc()
172172
}
173173
}
174174

175-
impl<'a, T: ?Sized + ToOwned + CodeLocation> CodeLocation for Cow<'a, T> {
175+
impl<T: ?Sized + ToOwned + CodeLocation> CodeLocation for Cow<'_, T> {
176176
fn loc(&self) -> Loc {
177177
(**self).loc()
178178
}

crates/solang/solang-parser/src/lexer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ pub enum Token<'input> {
182182
Annotation(&'input str),
183183
}
184184

185-
impl<'input> fmt::Display for Token<'input> {
185+
impl fmt::Display for Token<'_> {
186186
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
187187
match self {
188188
Token::Identifier(id) => write!(f, "{id}"),

crates/solang/src/codegen/mod.rs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ use crate::codegen::yul::generate_yul_function_cfg;
4343
use crate::sema::diagnostics::Diagnostics;
4444
use crate::sema::eval::eval_const_number;
4545
use crate::sema::Recurse;
46-
#[cfg(feature = "wasm_opt")]
47-
use contract_build::OptimizationPasses;
4846
use num_bigint::{BigInt, Sign};
4947
use num_rational::BigRational;
5048
use num_traits::{FromPrimitive, Zero};
@@ -69,30 +67,6 @@ pub enum OptimizationLevel {
6967
Aggressive = 3,
7068
}
7169

72-
#[cfg(feature = "llvm")]
73-
impl From<OptimizationLevel> for inkwell::OptimizationLevel {
74-
fn from(level: OptimizationLevel) -> Self {
75-
match level {
76-
OptimizationLevel::None => inkwell::OptimizationLevel::None,
77-
OptimizationLevel::Less => inkwell::OptimizationLevel::Less,
78-
OptimizationLevel::Default => inkwell::OptimizationLevel::Default,
79-
OptimizationLevel::Aggressive => inkwell::OptimizationLevel::Aggressive,
80-
}
81-
}
82-
}
83-
84-
#[cfg(feature = "llvm")]
85-
impl From<inkwell::OptimizationLevel> for OptimizationLevel {
86-
fn from(level: inkwell::OptimizationLevel) -> Self {
87-
match level {
88-
inkwell::OptimizationLevel::None => OptimizationLevel::None,
89-
inkwell::OptimizationLevel::Less => OptimizationLevel::Less,
90-
inkwell::OptimizationLevel::Default => OptimizationLevel::Default,
91-
inkwell::OptimizationLevel::Aggressive => OptimizationLevel::Aggressive,
92-
}
93-
}
94-
}
95-
9670
#[derive(Clone, Debug, PartialEq)]
9771
pub struct Options {
9872
pub dead_storage: bool,
@@ -105,8 +79,6 @@ pub struct Options {
10579
pub log_api_return_codes: bool,
10680
pub log_runtime_errors: bool,
10781
pub log_prints: bool,
108-
#[cfg(feature = "wasm_opt")]
109-
pub wasm_opt: Option<OptimizationPasses>,
11082
}
11183

11284
impl Default for Options {
@@ -122,8 +94,6 @@ impl Default for Options {
12294
log_api_return_codes: false,
12395
log_runtime_errors: false,
12496
log_prints: true,
125-
#[cfg(feature = "wasm_opt")]
126-
wasm_opt: None,
12797
}
12898
}
12999
}

crates/solang/src/codegen/strength_reduce/reaching_values.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub(super) fn reaching_values(
8585
/// changes in the set.
8686
/// There is a discussion to improve this function: https://github.com/hyperledger/solang/issues/934
8787
fn update_map(var_no: usize, set: &HashSet<Value>, map: &mut Variables) -> bool {
88-
return if let Some(existing) = map.get_mut(&var_no) {
88+
if let Some(existing) = map.get_mut(&var_no) {
8989
if existing.iter().next().map_or(false, |v| v.all_unknown()) {
9090
// If we already think it is unknown, nothing can improve on that
9191
false
@@ -134,7 +134,7 @@ fn update_map(var_no: usize, set: &HashSet<Value>, map: &mut Variables) -> bool
134134
}
135135

136136
true
137-
};
137+
}
138138
}
139139

140140
/// For a given instruction, calculate the new reaching values

crates/solang/src/codegen/subexpression_elimination/available_expression_set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::cell::RefCell;
1010
use std::collections::{HashMap, HashSet};
1111
use std::rc::Rc;
1212

13-
impl<'a, 'b: 'a> AvailableExpressionSet<'a> {
13+
impl<'a: 'a> AvailableExpressionSet<'a> {
1414
/// Deep clone a set
1515
pub fn deep_clone(&self) -> AvailableExpressionSet<'a> {
1616
let mut new_set = AvailableExpressionSet {

crates/solang/src/languageserver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,7 +2065,7 @@ impl LanguageServer for SolangServer {
20652065

20662066
async fn initialized(&self, _: InitializedParams) {
20672067
self.client
2068-
.log_message(MessageType::INFO, format!("Solang language server initialized"))
2068+
.log_message(MessageType::INFO, "Solang language server initialized".to_string())
20692069
.await;
20702070
}
20712071

@@ -2592,7 +2592,7 @@ impl LanguageServer for SolangServer {
25922592
let mut locations: Vec<_> = caches
25932593
.iter()
25942594
.flat_map(|(p, cache)| {
2595-
let uri = Url::parse(&p).unwrap();
2595+
let uri = Url::parse(p).unwrap();
25962596
cache
25972597
.references
25982598
.iter()

0 commit comments

Comments
 (0)