Skip to content

Commit

Permalink
fmt and clippy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
xunilrj committed Dec 7, 2023
1 parent 5eef47f commit 29da837
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 25 deletions.
6 changes: 3 additions & 3 deletions sway-core/src/decl_engine/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ impl<T> DeclId<T> {
self.0
}

pub fn unique_id(&self) -> DeclUniqueId
where
T: 'static
pub fn unique_id(&self) -> DeclUniqueId
where
T: 'static,
{
let mut hasher = DefaultHasher::default();
std::any::TypeId::of::<T>().hash(&mut hasher);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,6 @@ impl TyImplTrait {
block_span,
} = impl_self;

let span_str = block_span.as_str().to_string();

let type_engine = ctx.engines.te();
let decl_engine = ctx.engines.de();
let engines = ctx.engines();
Expand Down Expand Up @@ -508,7 +506,6 @@ impl TyImplTrait {
};

// Now lets type check the body of the functions (for real this time).
let a = ordered_node_indices.clone();
for idx in ordered_node_indices {
match (&items[idx], &new_items[idx]) {
(ImplItem::Fn(fn_decl), TyTraitItem::Fn(decl_ref)) => {
Expand Down
8 changes: 4 additions & 4 deletions sway-core/src/semantic_analysis/namespace/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,12 @@ impl Items {
}

pub(crate) fn check_symbol(&self, name: &Ident) -> Result<&ty::TyDecl, CompileError> {
self.symbols.get(name).ok_or_else(|| {
CompileError::SymbolNotFound {
self.symbols
.get(name)
.ok_or_else(|| CompileError::SymbolNotFound {
name: name.clone(),
span: name.span(),
}
})
})
}

pub fn get_items_for_type(&self, engines: &Engines, type_id: TypeId) -> Vec<ty::TyTraitItem> {
Expand Down
10 changes: 4 additions & 6 deletions sway-core/src/semantic_analysis/namespace/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,10 @@ impl Root {
// TODO: check that the symbol import is public?
self.resolve_symbol(handler, engines, src_path, true_symbol, self_type)
}
_ => {
module
.check_symbol(true_symbol)
.map_err(|e| handler.emit_err(e))
.cloned()
}
_ => module
.check_symbol(true_symbol)
.map_err(|e| handler.emit_err(e))
.cloned(),
}
}
}
Expand Down
10 changes: 4 additions & 6 deletions sway-core/src/semantic_analysis/namespace/trait_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -997,12 +997,10 @@ impl TraitMap {
span: symbol.span(),
},
)),
Ordering::Less => {
Err(handler.emit_err(CompileError::SymbolNotFound {
name: symbol.clone(),
span: symbol.span(),
}))
}
Ordering::Less => Err(handler.emit_err(CompileError::SymbolNotFound {
name: symbol.clone(),
span: symbol.span(),
})),
Ordering::Equal => Ok(candidates.values().next().unwrap().clone()),
}
}
Expand Down
2 changes: 1 addition & 1 deletion sway-core/src/semantic_analysis/type_check_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use petgraph::Graph;
use sway_error::error::CompileError;
use sway_error::handler::{ErrorEmitted, Handler};

use crate::decl_engine::{AssociatedItemDeclId, DeclId, DeclIdIndexType, DeclUniqueId};
use crate::decl_engine::{AssociatedItemDeclId, DeclId, DeclUniqueId};
use crate::engine_threading::DebugWithEngines;
use crate::language::ty::{self, TyFunctionDecl, TyTraitItem};
use crate::Engines;
Expand Down
1 change: 0 additions & 1 deletion sway-lsp/src/utils/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,4 @@ pub(crate) fn print_decl_engine_types(
ty::TyAstNodeContent::SideEffect(side_effect) => format!("{result}{side_effect:#?}"),
ty::TyAstNodeContent::Error(_, _) => format!("{result}error"),
})
.fold("".to_string(), |output, s| format!("{output}{s}\n"))
}
2 changes: 1 addition & 1 deletion test/src/e2e_vm_tests/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ pub(crate) fn runs_in_vm(
}
}
}

Ok(VMExecutionResult::Fuel(
*transition.state(),
transition.receipts().to_vec(),
Expand Down

0 comments on commit 29da837

Please sign in to comment.