match on chars instead of &strs for .split() or .strip_prefix()
This commit is contained in:
parent
cec34a43b1
commit
7a7708904b
@ -932,7 +932,7 @@ fn compute_2229_migrations_for_trait(
|
|||||||
var_hir_id: hir::HirId,
|
var_hir_id: hir::HirId,
|
||||||
closure_clause: hir::CaptureBy,
|
closure_clause: hir::CaptureBy,
|
||||||
) -> Option<FxIndexMap<UpvarMigrationInfo, UnordSet<&'static str>>> {
|
) -> Option<FxIndexMap<UpvarMigrationInfo, UnordSet<&'static str>>> {
|
||||||
let auto_traits_def_id = vec![
|
let auto_traits_def_id = [
|
||||||
self.tcx.lang_items().clone_trait(),
|
self.tcx.lang_items().clone_trait(),
|
||||||
self.tcx.lang_items().sync_trait(),
|
self.tcx.lang_items().sync_trait(),
|
||||||
self.tcx.get_diagnostic_item(sym::Send),
|
self.tcx.get_diagnostic_item(sym::Send),
|
||||||
|
@ -15,11 +15,11 @@ struct Indentor<'a, 'b> {
|
|||||||
|
|
||||||
impl Write for Indentor<'_, '_> {
|
impl Write for Indentor<'_, '_> {
|
||||||
fn write_str(&mut self, s: &str) -> std::fmt::Result {
|
fn write_str(&mut self, s: &str) -> std::fmt::Result {
|
||||||
for line in s.split_inclusive("\n") {
|
for line in s.split_inclusive('\n') {
|
||||||
if self.on_newline {
|
if self.on_newline {
|
||||||
self.f.write_str(" ")?;
|
self.f.write_str(" ")?;
|
||||||
}
|
}
|
||||||
self.on_newline = line.ends_with("\n");
|
self.on_newline = line.ends_with('\n');
|
||||||
self.f.write_str(line)?;
|
self.f.write_str(line)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,11 +279,11 @@ pub(crate) fn handle_cli_component(&mut self, component: &str) -> Result<(), ()>
|
|||||||
// set of all values like `y` or `n` used to be. Therefore, if this flag had previously been
|
// set of all values like `y` or `n` used to be. Therefore, if this flag had previously been
|
||||||
// set in bulk with its historical values, then manually setting a component clears that
|
// set in bulk with its historical values, then manually setting a component clears that
|
||||||
// `explicitly_set` state.
|
// `explicitly_set` state.
|
||||||
if let Some(component_to_enable) = component.strip_prefix("+") {
|
if let Some(component_to_enable) = component.strip_prefix('+') {
|
||||||
self.explicitly_set = None;
|
self.explicitly_set = None;
|
||||||
self.components.insert(component_to_enable.parse()?);
|
self.components.insert(component_to_enable.parse()?);
|
||||||
Ok(())
|
Ok(())
|
||||||
} else if let Some(component_to_disable) = component.strip_prefix("-") {
|
} else if let Some(component_to_disable) = component.strip_prefix('-') {
|
||||||
self.explicitly_set = None;
|
self.explicitly_set = None;
|
||||||
self.components.remove(component_to_disable.parse()?);
|
self.components.remove(component_to_disable.parse()?);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -1145,7 +1145,7 @@ pub(crate) fn parse_link_self_contained(slot: &mut LinkSelfContained, v: Option<
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2. Parse a list of enabled and disabled components.
|
// 2. Parse a list of enabled and disabled components.
|
||||||
for comp in s.split(",") {
|
for comp in s.split(',') {
|
||||||
if slot.handle_cli_component(comp).is_err() {
|
if slot.handle_cli_component(comp).is_err() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ fn str_to_cdata(s: &str) -> String {
|
|||||||
let escaped_output = s.replace("]]>", "]]]]><![CDATA[>");
|
let escaped_output = s.replace("]]>", "]]]]><![CDATA[>");
|
||||||
let escaped_output = escaped_output.replace("<?", "<]]><![CDATA[?");
|
let escaped_output = escaped_output.replace("<?", "<]]><![CDATA[?");
|
||||||
// We also smuggle newlines as 
 so as to keep all the output on one line
|
// We also smuggle newlines as 
 so as to keep all the output on one line
|
||||||
let escaped_output = escaped_output.replace("\n", "]]>
<![CDATA[");
|
let escaped_output = escaped_output.replace('\n', "]]>
<![CDATA[");
|
||||||
// Prune empty CDATA blocks resulting from any escaping
|
// Prune empty CDATA blocks resulting from any escaping
|
||||||
let escaped_output = escaped_output.replace("<![CDATA[]]>", "");
|
let escaped_output = escaped_output.replace("<![CDATA[]]>", "");
|
||||||
format!("<![CDATA[{}]]>", escaped_output)
|
format!("<![CDATA[{}]]>", escaped_output)
|
||||||
|
Loading…
Reference in New Issue
Block a user