librustc_back: remove unnecessary as_slice() calls

This commit is contained in:
Jorge Aparicio 2014-11-27 13:57:31 -05:00
parent 00f3c3f7a7
commit 7d8eabb226
4 changed files with 15 additions and 17 deletions

View File

@ -12,7 +12,7 @@ use target_strs;
use syntax::abi;
pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t {
let cc_args = if target_triple.as_slice().contains("thumb") {
let cc_args = if target_triple.contains("thumb") {
vec!("-mthumb".to_string())
} else {
vec!("-marm".to_string())

View File

@ -156,9 +156,9 @@ mod test {
"rpath2".to_string(),
"rpath1".to_string()
]);
assert!(res.as_slice() == [
"rpath1".to_string(),
"rpath2".to_string()
assert!(res == [
"rpath1",
"rpath2",
]);
}
@ -176,11 +176,11 @@ mod test {
"4a".to_string(),
"3".to_string()
]);
assert!(res.as_slice() == [
"1a".to_string(),
"2".to_string(),
"4a".to_string(),
"3".to_string()
assert!(res == [
"1a",
"2",
"4a",
"3",
]);
}
@ -196,7 +196,7 @@ mod test {
realpath: |p| Ok(p.clone())
};
let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
assert_eq!(res.as_slice(), "$ORIGIN/../lib");
assert_eq!(res, "$ORIGIN/../lib");
}
#[test]
@ -211,7 +211,7 @@ mod test {
realpath: |p| Ok(p.clone())
};
let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
assert_eq!(res.as_slice(), "$ORIGIN/../lib");
assert_eq!(res, "$ORIGIN/../lib");
}
#[test]
@ -226,7 +226,7 @@ mod test {
realpath: |p| Ok(p.clone())
};
let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
assert_eq!(res.as_slice(), "$ORIGIN/../lib");
assert_eq!(res, "$ORIGIN/../lib");
}
#[test]
@ -241,6 +241,6 @@ mod test {
realpath: |p| Ok(p.clone())
};
let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
assert_eq!(res.as_slice(), "@loader_path/../lib");
assert_eq!(res, "@loader_path/../lib");
}
}

View File

@ -263,7 +263,7 @@ pub trait Digest {
/// Convenience function that retrieves the result of a digest as a
/// String in hexadecimal format.
fn result_str(&mut self) -> String {
self.result_bytes().as_slice().to_hex().to_string()
self.result_bytes().to_hex().to_string()
}
}
@ -568,7 +568,6 @@ mod tests {
while left > 0u {
let take = (left + 1u) / 2u;
sh.input_str(t.input
.as_slice()
.slice(len - left, take + len - left));
left = left - take;
}

View File

@ -200,7 +200,7 @@ impl Target {
pub fn adjust_abi(&self, abi: abi::Abi) -> abi::Abi {
match abi {
abi::System => {
if self.options.is_like_windows && self.arch.as_slice() == "x86" {
if self.options.is_like_windows && self.arch == "x86" {
abi::Stdcall
} else {
abi::C
@ -308,7 +308,6 @@ impl Target {
( $($name:ident),+ ) => (
{
let target = target.replace("-", "_");
let target = target.as_slice();
if false { }
$(
else if target == stringify!($name) {