Skip to content

Commit

Permalink
Make clippy happy again and allow type-complexity warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov committed Jul 26, 2017
1 parent 213d5a7 commit 8061392
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ clean:

clippy:
command -v cargo-clippy >/dev/null 2>&1 || cargo install clippy
cargo clippy -- --cfg test -D warnings -A doc-markdown
cargo clippy -- --cfg test -D warnings -A doc-markdown -A type-complexity

test: bdcs-api clippy
RUST_BACKTRACE=1 cargo test --features "strict"
Expand Down
13 changes: 6 additions & 7 deletions src/api/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1579,12 +1579,11 @@ pub fn recipes_diff(recipe_name: &str, from_commit: &str, to_commit: &str,

let new_recipe = match to_commit {
"WORKSPACE" => {
let recipe = match read_from_workspace(&workspace_dir(&repo, "master"), recipe_name) {
Some(r) => r,
// TODO Need to add error handling so this can be a try!()
None => recipe::read(&repo, recipe_name, "master", None).unwrap()
};
recipe
match read_from_workspace(&workspace_dir(&repo, "master"), recipe_name) {
Some(r) => r,
// TODO Need to add error handling so this can be a try!()
None => recipe::read(&repo, recipe_name, "master", None).unwrap()
}
},
"NEWEST" => recipe::read(&repo, recipe_name, "master", None).unwrap(),
commit => match recipe::read(&repo, recipe_name, "master", Some(commit)) {
Expand All @@ -1596,7 +1595,7 @@ pub fn recipes_diff(recipe_name: &str, from_commit: &str, to_commit: &str,
}
};

let diff = recipe::diff(old_recipe, new_recipe);
let diff = recipe::diff(&old_recipe, &new_recipe);

CORS(JSON(RecipeDiff {
diff: diff
Expand Down
4 changes: 3 additions & 1 deletion src/recipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ impl Recipe {
}

/// Return the matching module entry
#[cfg_attr(feature="cargo-clippy", allow(ptr_arg))]
pub fn find_module(&self, name: &String) -> Option<Modules> {
match self.modules.binary_search_by_key(name, |m| m.name.clone()) {
Ok(idx) => Some(self.modules[idx].clone()),
Expand All @@ -204,6 +205,7 @@ impl Recipe {
}

/// Return the matching package entry
#[cfg_attr(feature="cargo-clippy", allow(ptr_arg))]
pub fn find_package(&self, name: &String) -> Option<Packages> {
match self.packages.binary_search_by_key(name, |p| p.name.clone()) {
Ok(idx) => Some(self.packages[idx].clone()),
Expand Down Expand Up @@ -951,7 +953,7 @@ pub fn tag(repo: &Repository, recipe_name: &str, branch: &str) -> Result<bool, R
/// also be used to diff arbitrary recipes, the differences will just be greater
/// and the name will be included as a difference.
///
pub fn diff(old: Recipe, new: Recipe) -> Vec<RecipeDiffEntry> {
pub fn diff(old: &Recipe, new: &Recipe) -> Vec<RecipeDiffEntry> {
debug!("diff"; "old" => format!("{:?}", old), "new" => format!("{:?}", new));

let mut diffs = Vec::new();
Expand Down

0 comments on commit 8061392

Please sign in to comment.