Commit 3a5deaca authored by Victor Zverovich's avatar Victor Zverovich Committed by Facebook GitHub Bot

Remove BaseFormatter::fbstr()

Summary: Remove `BaseFormatter::fbstr()` because it is virtually unused and those few cases that do use it are better off with `std::string`.

Reviewed By: yfeldblum

Differential Revision: D26358276

fbshipit-source-id: e96b4958735b3c9c03010e1e3dcdd01abd2d6a33
parent 1486429b
......@@ -385,7 +385,7 @@ void formatFormatter(
arg.align != FormatArg::Align::DEFAULT) {
// We can only avoid creating a temporary string if we align left,
// as we'd need to know the size beforehand otherwise
format_value::formatString(formatter.fbstr(), arg, cb);
format_value::formatString(formatter.str(), arg, cb);
} else {
auto fn = [&arg, &cb](StringPiece sp) mutable {
int sz = static_cast<int>(sp.size());
......
......@@ -97,15 +97,6 @@ class BaseFormatter {
return s;
}
/**
* Conversion to fbstring
*/
fbstring fbstr() const {
fbstring s;
appendTo(s);
return s;
}
/**
* Metadata to identify generated children of BaseFormatter
*/
......
......@@ -95,7 +95,7 @@ std::cout << format("{0:05d} decimal = {0:04x} hex", 42);
// Formatter objects may be written to a string using folly::to or
// folly::toAppend (see folly/Conv.h), or by calling their appendTo(),
// str(), and fbstr() methods
// and str() methods
std::string s = format("The only answer is {}", 42).str();
std::cout << s;
// => "The only answer is 42"
......
......@@ -178,8 +178,8 @@ BENCHMARK_RELATIVE(format_nested_fbstrings, iters) {
format(
&out,
"{} {}",
format("{} {}", i, i + 1).fbstr(),
format("{} {}", -i, -i - 1).fbstr());
format("{} {}", i, i + 1).str(),
format("{} {}", -i, -i - 1).str());
});
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment