summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/export/pdf/page.rs4
-rw-r--r--src/ide/complete.rs2
-rw-r--r--src/model/content.rs2
-rw-r--r--src/syntax/ast.rs2
-rw-r--r--src/util/eco.rs12
5 files changed, 16 insertions, 6 deletions
diff --git a/src/export/pdf/page.rs b/src/export/pdf/page.rs
index d1a2e70e..ef6c0ccc 100644
--- a/src/export/pdf/page.rs
+++ b/src/export/pdf/page.rs
@@ -115,9 +115,7 @@ fn write_page(ctx: &mut PdfContext, page: Page) {
link.subtype(AnnotationType::Link).rect(rect);
match dest {
Destination::Url(uri) => {
- link.action()
- .action_type(ActionType::Uri)
- .uri(Str(uri.as_str().as_bytes()));
+ link.action().action_type(ActionType::Uri).uri(Str(uri.as_bytes()));
}
Destination::Internal(loc) => {
let index = loc.page.get() - 1;
diff --git a/src/ide/complete.rs b/src/ide/complete.rs
index 5c64d801..eda1410f 100644
--- a/src/ide/complete.rs
+++ b/src/ide/complete.rs
@@ -407,7 +407,7 @@ fn import_completions(
}
for (name, value) in module.scope().iter() {
- if existing.iter().all(|ident| ident.as_str() != name.as_str()) {
+ if existing.iter().all(|ident| ident.as_str() != name) {
ctx.value_completion(Some(name.clone()), value, None);
}
}
diff --git a/src/model/content.rs b/src/model/content.rs
index 143f97aa..e6cb6d28 100644
--- a/src/model/content.rs
+++ b/src/model/content.rs
@@ -173,7 +173,7 @@ impl Content {
for modifier in &self.modifiers {
if let Modifier::Field(other, value) = modifier {
- if name == other.as_str() {
+ if name == other {
return Some(value.clone());
}
}
diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs
index e844f622..af7fedce 100644
--- a/src/syntax/ast.rs
+++ b/src/syntax/ast.rs
@@ -459,7 +459,7 @@ impl Shorthand {
/// Get the shorthanded character.
pub fn get(&self) -> char {
- let text = self.0.text().as_str();
+ let text = self.0.text();
Self::LIST
.iter()
.find(|&&(s, _)| s == text)
diff --git a/src/util/eco.rs b/src/util/eco.rs
index dccb68a8..ceaac2f5 100644
--- a/src/util/eco.rs
+++ b/src/util/eco.rs
@@ -262,6 +262,18 @@ impl PartialEq<&str> for EcoString {
}
}
+impl PartialEq<EcoString> for str {
+ fn eq(&self, other: &EcoString) -> bool {
+ self.eq(other.as_str())
+ }
+}
+
+impl PartialEq<EcoString> for &str {
+ fn eq(&self, other: &EcoString) -> bool {
+ (*self).eq(other.as_str())
+ }
+}
+
impl Ord for EcoString {
fn cmp(&self, other: &Self) -> Ordering {
self.as_str().cmp(other.as_str())