Skip to content

Instantly share code, notes, and snippets.

@daboross
Created February 27, 2017 00:07
Show Gist options
  • Save daboross/7219eac8e79077142abe50c4cc0973c9 to your computer and use it in GitHub Desktop.
Save daboross/7219eac8e79077142abe50c4cc0973c9 to your computer and use it in GitHub Desktop.
Rustfmt formatting example
fn main() {
let x = Struct {
a_field: vec![
AnotherStruct {
time_period: 8,
energy_harvested: stats_max.energyHarvested8,
energy_spent_creeps: stats_max.energyCreeps8,
energy_spent_control: stats_max.energyControl8,
energy_spent_construction: stats_max.energyConstruction8,
creep_parts_produced: stats_max.creepsProduced8,
creep_parts_lost: stats_max.creepsLost8,
},
AnotherStruct {
time_period: 180,
energy_harvested: stats_max.energyHarvested180,
energy_spent_creeps: stats_max.energyCreeps180,
energy_spent_control: stats_max.energyControl180,
energy_spent_construction: stats_max.energyConstruction180,
creep_parts_produced: stats_max.creepsProduced180,
creep_parts_lost: stats_max.creepsLost180,
},
AnotherStruct {
time_period: 1440,
energy_harvested: stats_max.energyHarvested1440,
energy_spent_creeps: stats_max.energyCreeps1440,
energy_spent_control: stats_max.energyControl1440,
energy_spent_construction: stats_max.energyConstruction1440,
creep_parts_produced: stats_max.creepsProduced1440,
creep_parts_lost: stats_max.creepsLost1440,
},
],
};
}
fn main() {
let x = Struct {
a_field: vec![AnotherStruct {
time_period: 8,
energy_harvested: stats_max.energyHarvested8,
energy_spent_creeps: stats_max.energyCreeps8,
energy_spent_control: stats_max.energyControl8,
energy_spent_construction: stats_max.energyConstruction8,
creep_parts_produced: stats_max.creepsProduced8,
creep_parts_lost: stats_max.creepsLost8,
},
AnotherStruct {
time_period: 180,
energy_harvested: stats_max.energyHarvested180,
energy_spent_creeps: stats_max.energyCreeps180,
energy_spent_control: stats_max.energyControl180,
energy_spent_construction: stats_max.energyConstruction180,
creep_parts_produced: stats_max.creepsProduced180,
creep_parts_lost: stats_max.creepsLost180,
},
AnotherStruct {
time_period: 1440,
energy_harvested: stats_max.energyHarvested1440,
energy_spent_creeps: stats_max.energyCreeps1440,
energy_spent_control: stats_max.energyControl1440,
energy_spent_construction: stats_max.energyConstruction1440,
creep_parts_produced: stats_max.creepsProduced1440,
creep_parts_lost: stats_max.creepsLost1440,
}],
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment