Skip to content

Commit c84ec6f

Browse files
committed
[rust] Simplify syntax for raw strings
1 parent 1182189 commit c84ec6f

File tree

8 files changed

+28
-28
lines changed

8 files changed

+28
-28
lines changed

rust/src/chrome.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,19 +220,19 @@ impl SeleniumManager for ChromeManager {
220220
HashMap::from([
221221
(
222222
BrowserPath::new(WINDOWS, STABLE),
223-
r#"Google\Chrome\Application\chrome.exe"#,
223+
r"Google\Chrome\Application\chrome.exe",
224224
),
225225
(
226226
BrowserPath::new(WINDOWS, BETA),
227-
r#"Google\Chrome Beta\Application\chrome.exe"#,
227+
r"Google\Chrome Beta\Application\chrome.exe",
228228
),
229229
(
230230
BrowserPath::new(WINDOWS, DEV),
231-
r#"Google\Chrome Dev\Application\chrome.exe"#,
231+
r"Google\Chrome Dev\Application\chrome.exe",
232232
),
233233
(
234234
BrowserPath::new(WINDOWS, NIGHTLY),
235-
r#"Google\Chrome SxS\Application\chrome.exe"#,
235+
r"Google\Chrome SxS\Application\chrome.exe",
236236
),
237237
(
238238
BrowserPath::new(MACOS, STABLE),
@@ -261,7 +261,7 @@ impl SeleniumManager for ChromeManager {
261261

262262
fn discover_browser_version(&mut self) -> Result<Option<String>, Error> {
263263
self.general_discover_browser_version(
264-
r#"HKCU\Software\Google\Chrome\BLBeacon"#,
264+
r"HKCU\Software\Google\Chrome\BLBeacon",
265265
REG_VERSION_ARG,
266266
DASH_DASH_VERSION,
267267
)

rust/src/edge.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,25 +107,25 @@ impl SeleniumManager for EdgeManager {
107107
if self.is_webview2() {
108108
HashMap::from([(
109109
BrowserPath::new(WINDOWS, STABLE),
110-
r#"Microsoft\EdgeWebView\Application"#,
110+
r"Microsoft\EdgeWebView\Application",
111111
)])
112112
} else {
113113
HashMap::from([
114114
(
115115
BrowserPath::new(WINDOWS, STABLE),
116-
r#"Microsoft\Edge\Application\msedge.exe"#,
116+
r"Microsoft\Edge\Application\msedge.exe",
117117
),
118118
(
119119
BrowserPath::new(WINDOWS, BETA),
120-
r#"Microsoft\Edge Beta\Application\msedge.exe"#,
120+
r"Microsoft\Edge Beta\Application\msedge.exe",
121121
),
122122
(
123123
BrowserPath::new(WINDOWS, DEV),
124-
r#"Microsoft\Edge Dev\Application\msedge.exe"#,
124+
r"Microsoft\Edge Dev\Application\msedge.exe",
125125
),
126126
(
127127
BrowserPath::new(WINDOWS, NIGHTLY),
128-
r#"Microsoft\Edge SxS\Application\msedge.exe"#,
128+
r"Microsoft\Edge SxS\Application\msedge.exe",
129129
),
130130
(
131131
BrowserPath::new(MACOS, STABLE),
@@ -158,20 +158,20 @@ impl SeleniumManager for EdgeManager {
158158
let arch = self.get_arch();
159159
if X32.is(arch) {
160160
(
161-
r#"HKLM\SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"#,
161+
r"HKLM\SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}",
162162
REG_PV_ARG,
163163
"",
164164
)
165165
} else {
166166
(
167-
r#"HKLM\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"#,
167+
r"HKLM\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}",
168168
REG_PV_ARG,
169169
"",
170170
)
171171
}
172172
} else {
173173
(
174-
r#"HKCU\Software\Microsoft\Edge\BLBeacon"#,
174+
r"HKCU\Software\Microsoft\Edge\BLBeacon",
175175
REG_VERSION_ARG,
176176
DASH_DASH_VERSION,
177177
)

rust/src/firefox.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const FIREFOX_HISTORY_DEV_ENDPOINT: &str = "firefox_history_development_releases
5656
const FIREFOX_NIGHTLY_URL: &str =
5757
"https://download.mozilla.org/?product=firefox-nightly-latest-ssl&os={}&lang={}";
5858
const FIREFOX_VOLUME: &str = "Firefox";
59-
const FIREFOX_NIGHTLY_VOLUME: &str = r#"Firefox\ Nightly"#;
59+
const FIREFOX_NIGHTLY_VOLUME: &str = r"Firefox\ Nightly";
6060
const MIN_DOWNLOADABLE_FIREFOX_VERSION_WIN: i32 = 13;
6161
const MIN_DOWNLOADABLE_FIREFOX_VERSION_MAC: i32 = 4;
6262
const MIN_DOWNLOADABLE_FIREFOX_VERSION_LINUX: i32 = 4;
@@ -132,24 +132,24 @@ impl SeleniumManager for FirefoxManager {
132132
HashMap::from([
133133
(
134134
BrowserPath::new(WINDOWS, STABLE),
135-
r#"Mozilla Firefox\firefox.exe"#,
135+
r"Mozilla Firefox\firefox.exe",
136136
),
137137
(
138138
BrowserPath::new(WINDOWS, BETA),
139139
// "",
140-
r#"Mozilla Firefox\firefox.exe"#,
140+
r"Mozilla Firefox\firefox.exe",
141141
),
142142
(
143143
BrowserPath::new(WINDOWS, DEV),
144-
r#"Firefox Developer Edition\firefox.exe"#,
144+
r"Firefox Developer Edition\firefox.exe",
145145
),
146146
(
147147
BrowserPath::new(WINDOWS, NIGHTLY),
148-
r#"Firefox Nightly\firefox.exe"#,
148+
r"Firefox Nightly\firefox.exe",
149149
),
150150
(
151151
BrowserPath::new(WINDOWS, ESR),
152-
r#"Mozilla Firefox\firefox.exe"#,
152+
r"Mozilla Firefox\firefox.exe",
153153
),
154154
(
155155
BrowserPath::new(MACOS, STABLE),
@@ -181,7 +181,7 @@ impl SeleniumManager for FirefoxManager {
181181

182182
fn discover_browser_version(&mut self) -> Result<Option<String>, Error> {
183183
self.general_discover_browser_version(
184-
r#"HKCU\Software\Mozilla\Mozilla Firefox"#,
184+
r"HKCU\Software\Mozilla\Mozilla Firefox",
185185
REG_CURRENT_VERSION_ARG,
186186
DASH_VERSION,
187187
)

rust/src/iexplorer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ impl SeleniumManager for IExplorerManager {
9393
fn get_browser_path_map(&self) -> HashMap<BrowserPath, &str> {
9494
HashMap::from([(
9595
BrowserPath::new(WINDOWS, STABLE),
96-
r#"Internet Explorer\iexplore.exe"#,
96+
r"Internet Explorer\iexplore.exe",
9797
)])
9898
}
9999

100100
fn discover_browser_version(&mut self) -> Result<Option<String>, Error> {
101101
self.general_discover_browser_version(
102-
r#"HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer"#,
102+
r"HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer",
103103
REG_VERSION_ARG,
104104
"",
105105
)

rust/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub const UNAVAILABLE_DOWNLOAD_WITH_MIN_VERSION_ERR_MSG: &str =
110110
pub const NOT_ADMIN_FOR_EDGE_INSTALLER_ERR_MSG: &str =
111111
"{} can only be installed in Windows with administrator permissions";
112112
pub const ONLINE_DISCOVERY_ERROR_MESSAGE: &str = "Unable to discover {}{} in online repository";
113-
pub const UNC_PREFIX: &str = r#"\\?\"#;
113+
pub const UNC_PREFIX: &str = r"\\?\";
114114

115115
pub trait SeleniumManager {
116116
// ----------------------------------------------------------

rust/src/safaritp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use std::string::ToString;
2929
pub const SAFARITP_NAMES: &[&str] = &[
3030
"safaritp",
3131
"safari technology preview",
32-
r#"safari\ technology\ preview"#,
32+
r"safari\ technology\ preview",
3333
"safaritechnologypreview",
3434
];
3535
pub const SAFARITPDRIVER_NAME: &str = "safaridriver";

rust/tests/browser_tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,18 @@ fn browser_beta_test(#[case] browser: String, #[case] driver_name: String) {
114114
#[case(
115115
"windows",
116116
"chrome",
117-
r#"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"#
117+
r"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
118118
)]
119119
#[case(
120120
"windows",
121121
"chrome",
122-
r#"C:\Program Files\Google\Chrome\Application\chrome.exe"#
122+
r"C:\Program Files\Google\Chrome\Application\chrome.exe"
123123
)]
124124
#[case("linux", "chrome", "/usr/bin/google-chrome")]
125125
#[case(
126126
"macos",
127127
"chrome",
128-
r#"/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"#
128+
r"/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
129129
)]
130130
#[case(
131131
"macos",

rust/tests/cache_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn cache_path_test() {
4040

4141
let driver_path = get_driver_path(&mut cmd);
4242
println!("*** Custom cache path: {}", driver_path);
43-
assert!(!driver_path.contains(r#"cache\selenium"#));
43+
assert!(!driver_path.contains(r"cache\selenium"));
4444

4545
let tmp_cache_path = Path::new(tmp_cache_folder_name);
4646
fs::remove_dir_all(tmp_cache_path).unwrap();

0 commit comments

Comments
 (0)