Skip to content

Commit 7d8eabb

Browse files
author
Jorge Aparicio
committed
librustc_back: remove unnecessary as_slice() calls
1 parent 00f3c3f commit 7d8eabb

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

src/librustc_back/arm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use target_strs;
1212
use syntax::abi;
1313

1414
pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t {
15-
let cc_args = if target_triple.as_slice().contains("thumb") {
15+
let cc_args = if target_triple.contains("thumb") {
1616
vec!("-mthumb".to_string())
1717
} else {
1818
vec!("-marm".to_string())

src/librustc_back/rpath.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ mod test {
156156
"rpath2".to_string(),
157157
"rpath1".to_string()
158158
]);
159-
assert!(res.as_slice() == [
160-
"rpath1".to_string(),
161-
"rpath2".to_string()
159+
assert!(res == [
160+
"rpath1",
161+
"rpath2",
162162
]);
163163
}
164164

@@ -176,11 +176,11 @@ mod test {
176176
"4a".to_string(),
177177
"3".to_string()
178178
]);
179-
assert!(res.as_slice() == [
180-
"1a".to_string(),
181-
"2".to_string(),
182-
"4a".to_string(),
183-
"3".to_string()
179+
assert!(res == [
180+
"1a",
181+
"2",
182+
"4a",
183+
"3",
184184
]);
185185
}
186186

@@ -196,7 +196,7 @@ mod test {
196196
realpath: |p| Ok(p.clone())
197197
};
198198
let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
199-
assert_eq!(res.as_slice(), "$ORIGIN/../lib");
199+
assert_eq!(res, "$ORIGIN/../lib");
200200
}
201201

202202
#[test]
@@ -211,7 +211,7 @@ mod test {
211211
realpath: |p| Ok(p.clone())
212212
};
213213
let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
214-
assert_eq!(res.as_slice(), "$ORIGIN/../lib");
214+
assert_eq!(res, "$ORIGIN/../lib");
215215
}
216216

217217
#[test]
@@ -226,7 +226,7 @@ mod test {
226226
realpath: |p| Ok(p.clone())
227227
};
228228
let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
229-
assert_eq!(res.as_slice(), "$ORIGIN/../lib");
229+
assert_eq!(res, "$ORIGIN/../lib");
230230
}
231231

232232
#[test]
@@ -241,6 +241,6 @@ mod test {
241241
realpath: |p| Ok(p.clone())
242242
};
243243
let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
244-
assert_eq!(res.as_slice(), "@loader_path/../lib");
244+
assert_eq!(res, "@loader_path/../lib");
245245
}
246246
}

src/librustc_back/sha2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ pub trait Digest {
263263
/// Convenience function that retrieves the result of a digest as a
264264
/// String in hexadecimal format.
265265
fn result_str(&mut self) -> String {
266-
self.result_bytes().as_slice().to_hex().to_string()
266+
self.result_bytes().to_hex().to_string()
267267
}
268268
}
269269

@@ -568,7 +568,6 @@ mod tests {
568568
while left > 0u {
569569
let take = (left + 1u) / 2u;
570570
sh.input_str(t.input
571-
.as_slice()
572571
.slice(len - left, take + len - left));
573572
left = left - take;
574573
}

src/librustc_back/target/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl Target {
200200
pub fn adjust_abi(&self, abi: abi::Abi) -> abi::Abi {
201201
match abi {
202202
abi::System => {
203-
if self.options.is_like_windows && self.arch.as_slice() == "x86" {
203+
if self.options.is_like_windows && self.arch == "x86" {
204204
abi::Stdcall
205205
} else {
206206
abi::C
@@ -308,7 +308,6 @@ impl Target {
308308
( $($name:ident),+ ) => (
309309
{
310310
let target = target.replace("-", "_");
311-
let target = target.as_slice();
312311
if false { }
313312
$(
314313
else if target == stringify!($name) {

0 commit comments

Comments
 (0)