[Crate] Enforce formatting in CI (#46)

* [CI] Check formatting

* Format all files
This commit is contained in:
Tom 2023-06-10 15:15:12 +00:00 committed by GitHub
parent a6279177bb
commit b95b2abe0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 251 additions and 170 deletions

View file

@ -71,7 +71,12 @@ impl ValveMasterServer {
let mut ips: Vec<(IpAddr, u16)> = Vec::new();
while buf.remaining_length() > 0 {
let ip = IpAddr::V4(Ipv4Addr::new(buf.get_u8()?, buf.get_u8()?, buf.get_u8()?, buf.get_u8()?));
let ip = IpAddr::V4(Ipv4Addr::new(
buf.get_u8()?,
buf.get_u8()?,
buf.get_u8()?,
buf.get_u8()?,
));
let port = buf.get_u16()?;
ips.push((ip, port));

View file

@ -15,7 +15,8 @@ pub enum Filter {
HasTags(Vec<String>),
MatchName(String),
MatchVersion(String),
/// Restrict to only a server if an IP hosts (on different ports) multiple servers.
/// Restrict to only a server if an IP hosts (on different ports) multiple
/// servers.
RestrictUniqueIP(bool),
/// Query for servers on a specific address.
OnAddress(String),
@ -133,7 +134,8 @@ impl Filter {
/// .insert(Filter::IsEmpty(false))
/// .insert(Filter::CanHavePassword(false));
/// ```
/// This will construct filters that search for servers that can't have a password, are not empty and run App ID 440.
/// This will construct filters that search for servers that can't have a
/// password, are not empty and run App ID 440.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SearchFilters {
filters: HashMap<Discriminant<Filter>, Filter>,
@ -208,8 +210,14 @@ impl SearchFilters {
bytes.extend(filter.to_bytes())
}
bytes.extend(SearchFilters::special_filter_to_bytes("nand", &self.nand_filters));
bytes.extend(SearchFilters::special_filter_to_bytes("nor", &self.nor_filters));
bytes.extend(SearchFilters::special_filter_to_bytes(
"nand",
&self.nand_filters,
));
bytes.extend(SearchFilters::special_filter_to_bytes(
"nor",
&self.nor_filters,
));
bytes.extend([0x00]);
bytes