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( ...@@ -385,7 +385,7 @@ void formatFormatter(
arg.align != FormatArg::Align::DEFAULT) { arg.align != FormatArg::Align::DEFAULT) {
// We can only avoid creating a temporary string if we align left, // We can only avoid creating a temporary string if we align left,
// as we'd need to know the size beforehand otherwise // 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 { } else {
auto fn = [&arg, &cb](StringPiece sp) mutable { auto fn = [&arg, &cb](StringPiece sp) mutable {
int sz = static_cast<int>(sp.size()); int sz = static_cast<int>(sp.size());
......
...@@ -97,15 +97,6 @@ class BaseFormatter { ...@@ -97,15 +97,6 @@ class BaseFormatter {
return s; return s;
} }
/**
* Conversion to fbstring
*/
fbstring fbstr() const {
fbstring s;
appendTo(s);
return s;
}
/** /**
* Metadata to identify generated children of BaseFormatter * Metadata to identify generated children of BaseFormatter
*/ */
......
...@@ -95,7 +95,7 @@ std::cout << format("{0:05d} decimal = {0:04x} hex", 42); ...@@ -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 // Formatter objects may be written to a string using folly::to or
// folly::toAppend (see folly/Conv.h), or by calling their appendTo(), // 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::string s = format("The only answer is {}", 42).str();
std::cout << s; std::cout << s;
// => "The only answer is 42" // => "The only answer is 42"
......
...@@ -178,8 +178,8 @@ BENCHMARK_RELATIVE(format_nested_fbstrings, iters) { ...@@ -178,8 +178,8 @@ BENCHMARK_RELATIVE(format_nested_fbstrings, iters) {
format( format(
&out, &out,
"{} {}", "{} {}",
format("{} {}", i, i + 1).fbstr(), format("{} {}", i, i + 1).str(),
format("{} {}", -i, -i - 1).fbstr()); 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