Skip to content

Commit f31ebf8

Browse files
ShaharNavehyouknowone
authored andcommitted
Use raw string where appropriate. add newlines
1 parent e6f5b6a commit f31ebf8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

vm/src/builtins/str.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ impl PyStr {
528528
radd?.call((zelf,), vm)
529529
} else {
530530
Err(vm.new_type_error(format!(
531-
"can only concatenate str (not \"{}\") to str",
531+
r#"can only concatenate str (not "{}") to str"#,
532532
other.class().name()
533533
)))
534534
}
@@ -570,6 +570,7 @@ impl PyStr {
570570
hash => hash,
571571
}
572572
}
573+
573574
#[cold]
574575
fn _compute_hash(&self, vm: &VirtualMachine) -> hash::PyHash {
575576
let hash_val = vm.state.hash_secret.hash_bytes(self.as_bytes());
@@ -583,6 +584,7 @@ impl PyStr {
583584
pub fn byte_len(&self) -> usize {
584585
self.data.len()
585586
}
587+
586588
#[inline]
587589
pub fn is_empty(&self) -> bool {
588590
self.data.is_empty()
@@ -1439,6 +1441,7 @@ impl PyStr {
14391441
struct CharLenStr<'a>(&'a str, usize);
14401442
impl std::ops::Deref for CharLenStr<'_> {
14411443
type Target = str;
1444+
14421445
fn deref(&self) -> &Self::Target {
14431446
self.0
14441447
}
@@ -1852,6 +1855,7 @@ impl AnyStrWrapper<Wtf8> for PyStrRef {
18521855
fn as_ref(&self) -> Option<&Wtf8> {
18531856
Some(self.as_wtf8())
18541857
}
1858+
18551859
fn is_empty(&self) -> bool {
18561860
self.data.is_empty()
18571861
}
@@ -1861,6 +1865,7 @@ impl AnyStrWrapper<str> for PyStrRef {
18611865
fn as_ref(&self) -> Option<&str> {
18621866
self.data.as_str()
18631867
}
1868+
18641869
fn is_empty(&self) -> bool {
18651870
self.data.is_empty()
18661871
}
@@ -1870,6 +1875,7 @@ impl AnyStrWrapper<AsciiStr> for PyStrRef {
18701875
fn as_ref(&self) -> Option<&AsciiStr> {
18711876
self.data.as_ascii()
18721877
}
1878+
18731879
fn is_empty(&self) -> bool {
18741880
self.data.is_empty()
18751881
}
@@ -1893,9 +1899,11 @@ impl anystr::AnyChar for char {
18931899
fn is_lowercase(self) -> bool {
18941900
self.is_lowercase()
18951901
}
1902+
18961903
fn is_uppercase(self) -> bool {
18971904
self.is_uppercase()
18981905
}
1906+
18991907
fn bytes_len(self) -> usize {
19001908
self.len_utf8()
19011909
}
@@ -2122,9 +2130,11 @@ impl anystr::AnyChar for ascii::AsciiChar {
21222130
fn is_lowercase(self) -> bool {
21232131
self.is_lowercase()
21242132
}
2133+
21252134
fn is_uppercase(self) -> bool {
21262135
self.is_uppercase()
21272136
}
2137+
21282138
fn bytes_len(self) -> usize {
21292139
1
21302140
}

0 commit comments

Comments
 (0)