Skip to content

Commit 6832509

Browse files
committed
PR adjustments
1 parent 9104192 commit 6832509

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

sway-core/src/ir_generation/function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ impl<'a> FnCompiler<'a> {
457457
))
458458
}
459459

460-
// Can be used to raw untyped slice and string slice
460+
// Can be used for raw untyped slice and string slice
461461
fn compile_slice(
462462
&mut self,
463463
context: &mut Context,

sway-core/src/language/literal.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ impl PartialEq for Literal {
9595
(Self::Numeric(l0), Self::Numeric(r0)) => l0 == r0,
9696
(Self::Boolean(l0), Self::Boolean(r0)) => l0 == r0,
9797
(Self::B256(l0), Self::B256(r0)) => l0 == r0,
98+
(Self::Binary(l0), Self::Binary(r0)) => l0 == r0,
9899
_ => false,
99100
}
100101
}

sway-core/src/semantic_analysis/ast_node/expression/typed_expression/method_application.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,10 @@ pub(crate) fn type_check_method_application(
534534
}
535535

536536
fn method_name_literal(method_name: &BaseIdent) -> Expression {
537-
let method_name_str = method_name.as_str().to_string();
537+
let method_name_str = method_name.as_str();
538538
let len_bytes = (method_name_str.len() as u64).to_be_bytes();
539539

540-
let mut blob = vec![];
540+
let mut blob = Vec::with_capacity(len_bytes.len() + method_name_str.len());
541541
blob.extend(len_bytes);
542542
blob.extend(method_name_str.as_bytes());
543543

sway-lsp/src/traverse/parsed_tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,6 @@ fn literal_to_symbol_kind(value: &Literal) -> SymbolKind {
12521252
Literal::String(..) => SymbolKind::StringLiteral,
12531253
Literal::B256(..) => SymbolKind::ByteLiteral,
12541254
Literal::Boolean(..) => SymbolKind::BoolLiteral,
1255-
Literal::Binary(_) => todo!(),
1255+
Literal::Binary(_) => unreachable!("literals cannot be expressed in the language yet"),
12561256
}
12571257
}

sway-lsp/src/utils/debug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ fn literal_to_string(literal: &Literal) -> String {
6767
Literal::String(len) => format!("str[{}]", len.as_str().len()),
6868
Literal::Boolean(_) => "bool".into(),
6969
Literal::B256(_) => "b256".into(),
70-
Literal::Binary(_) => todo!(),
70+
Literal::Binary(_) => unreachable!("literals cannot be expressed in the language yet"),
7171
}
7272
}
7373

0 commit comments

Comments
 (0)