{"action":"opened","issue":{"url":"https://api.github.com/repos/exercism/xrust/issues/45","labels_url":"https://api.github.com/repos/exercism/xrust/issues/45/labels{/name}","comments_url":"https://api.github.com/repos/exercism/xrust/issues/45/comments","events_url":"https://api.github.com/repos/exercism/xrust/issues/45/events","html_url":"https://github.com/exercism/xrust/issues/45","id":99855276,"number":45,"title":"handle different lengths error case in point-mutations","user":{"login":"ekse","id":77594,"avatar_url":"https://avatars.githubusercontent.com/u/77594?v=3","gravatar_id":"","url":"https://api.github.com/users/ekse","html_url":"https://github.com/ekse","followers_url":"https://api.github.com/users/ekse/followers","following_url":"https://api.github.com/users/ekse/following{/other_user}","gists_url":"https://api.github.com/users/ekse/gists{/gist_id}","starred_url":"https://api.github.com/users/ekse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekse/subscriptions","organizations_url":"https://api.github.com/users/ekse/orgs","repos_url":"https://api.github.com/users/ekse/repos","events_url":"https://api.github.com/users/ekse/events{/privacy}","received_events_url":"https://api.github.com/users/ekse/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-09T02:41:04Z","updated_at":"2015-08-09T02:41:04Z","closed_at":null,"body":"The current tests for the point-mutations exercise assumes that both strings are of the same length. `hamming_distance()`  should return an error when strings of different lengths are passed. I think the idiomatic way to this in Rust would be to change the function signature to return a Result\r\n\r\n```rust\r\npub fn hamming_distance(a : &str, b: &str) -> Result<u32, &'static str> \r\n```\r\nFor expected tests cases a call to unwrap() needs to be added, for  error cases we can compare with the error.\r\n\r\n```rust\r\n#[test]\r\nfn test_no_difference_between_empty_strands() {\r\n    assert_eq!(dna::hamming_distance(\"\", \"\").unwrap(), 0);\r\n}\r\n\r\n#[test]\r\nfn test_second_string_is_longer() {\r\n    assert_eq!(dna::hamming_distance(\"A\", \"AA\"), Result::Err(\"inputs of different length\"));\r\n}\r\n```\r\n\r\nI will send a pull request for this issue."}}