Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrks committed Jun 1, 2020
1 parent ec7660d commit 2ea42df
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ extern crate lazy_static;

extern crate toml;

pub mod icons;
pub mod config;
pub mod icons;

pub struct Options {
pub icons: Map<String, char>,
pub aliases: Map<String, String>,
pub general: Map<String, String>,
pub names: bool
pub names: bool,
}

impl Default for Options {
Expand All @@ -41,7 +41,7 @@ impl Default for Options {
icons: icons::NONE.clone(),
aliases: config::EMPTY_MAP.clone(),
general: config::EMPTY_MAP.clone(),
names: true
names: true,
}
}
}
Expand Down Expand Up @@ -104,9 +104,9 @@ fn get_class(conn: &xcb::Connection, id: u32, options: &Options) -> Result<Strin
});

Ok(results_with_icons
.next_back()
.ok_or_else(|| LookupError::WindowClass(id))?
.to_string())
.next_back()
.ok_or_else(|| LookupError::WindowClass(id))?
.to_string())
}

/// Checks if window is of type normal. The problem with this is that not all
Expand Down Expand Up @@ -186,13 +186,16 @@ fn get_classes(workspace: &Node, x_conn: &xcb::Connection, options: &Options) ->
}

/// Update all workspace names in tree
pub fn update_tree(x_conn: &xcb::Connection, i3_conn: &mut I3Connection, options: &Options) -> Result<(), Error> {
pub fn update_tree(
x_conn: &xcb::Connection,
i3_conn: &mut I3Connection,
options: &Options,
) -> Result<(), Error> {
let tree = i3_conn.get_tree()?;
for workspace in get_workspaces(tree) {

let separator = match options.general.get("separator") {
Some(s) => s,
None => " | "
None => " | ",
};

let classes = get_classes(&workspace, &x_conn, options).join(separator);
Expand Down Expand Up @@ -339,7 +342,10 @@ mod tests {
let mut result: Vec<Vec<u32>> = Vec::new();
for workspace in workspaces {
result.push(super::get_ids(vec![workspace.nodes.iter().collect()]));
result.push(super::get_ids(vec![workspace.floating_nodes.iter().collect()]));
result.push(super::get_ids(vec![workspace
.floating_nodes
.iter()
.collect()]));
}
let result: usize = result.iter().filter(|v| !v.is_empty()).count();
assert_eq!(result, 2);
Expand Down

0 comments on commit 2ea42df

Please sign in to comment.