Skip to content

Commit

Permalink
as_str
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Oct 16, 2020
1 parent 6edbdbc commit 9eb3823
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ pub fn default_configuration(sess: &Session) -> CrateConfig {
}
}
ret.insert((sym::target_arch, Some(Symbol::intern(arch))));
ret.insert((sym::target_endian, Some(Symbol::intern(end.name()))));
ret.insert((sym::target_endian, Some(Symbol::intern(end.as_str()))));
ret.insert((sym::target_pointer_width, Some(Symbol::intern(&wordsz))));
ret.insert((sym::target_env, Some(Symbol::intern(env))));
ret.insert((sym::target_vendor, Some(Symbol::intern(vendor))));
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_target/src/abi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ impl TargetDataLayout {
return Err(format!(
"inconsistent target specification: \"data-layout\" claims \
architecture is {}-endian, while \"target-endian\" is `{}`",
dl.endian.name(),
target.target_endian.name()
dl.endian.as_str(),
target.target_endian.as_str()
));
}

Expand Down Expand Up @@ -235,7 +235,7 @@ pub enum Endian {
}

impl Endian {
pub fn name(&self) -> &str {
pub fn as_str(&self) -> &str {
match self {
Self::Little => "little",
Self::Big => "big",
Expand All @@ -253,7 +253,7 @@ impl Endian {

impl fmt::Debug for Endian {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.name())
f.write_str(self.as_str())
}
}

Expand All @@ -271,7 +271,7 @@ impl FromStr for Endian {

impl ToJson for Endian {
fn to_json(&self) -> Json {
Json::String(self.name().to_owned())
Json::String(self.as_str().to_owned())
}
}

Expand Down

0 comments on commit 9eb3823

Please sign in to comment.