Skip to content

Remove #[allow(unused_variables)]#493

Merged
coriolinus merged 6 commits intoexercism:masterfrom
coriolinus:remove-allow-unused-variables
Apr 8, 2018
Merged

Remove #[allow(unused_variables)]#493
coriolinus merged 6 commits intoexercism:masterfrom
coriolinus:remove-allow-unused-variables

Conversation

@coriolinus
Copy link
Copy Markdown
Member

Closes #481.

Note that in the case of the react exercise, it wasn't possible to follow the standard procedure of adding a use of the variables in the unimplemented block. This is because react uses the generic types F and T, which are not bounded by the Debug trait. In that case, I fell back to the underscore-prefix pattern; students who reach a level 10 exercise should not be confused by it.

@coriolinus coriolinus changed the title Remove allow unused variables Remove #[allow(unused_variables)] Apr 8, 2018
Copy link
Copy Markdown
Member

@petertseng petertseng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. Note one inconsistent capitalisation. I Approve despite this because the fix will be trivial and because I expect to be unavailable for hours.

Comment thread exercises/react/src/lib.rs Outdated
pub fn remove_callback(&mut self, cell: CellID, callback: CallbackID) -> Result<(), RemoveCallbackError> {
unimplemented!()
unimplemented!(
"Remove the callback identified by the CallbackId {:?} from the cell {:?}",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CallbackId's capitalisation is inconsistent with the fact that CallbackID is used a few lines above

@coriolinus coriolinus force-pushed the remove-allow-unused-variables branch from 9f847e7 to 514870c Compare April 8, 2018 12:49
Note that in this case, we couldn't follow the standard procedure
of adding the variables to the unimplemented block, because the
generic types F and T aren't bounded by Debug. Worse, the closures
expected for F possibly _can't_ be bounded by Debug.

We use named underscore variables as a fallback.
@coriolinus coriolinus force-pushed the remove-allow-unused-variables branch from 514870c to 15473b9 Compare April 8, 2018 12:54
@coriolinus coriolinus merged commit 33f5f7f into exercism:master Apr 8, 2018
@coriolinus coriolinus deleted the remove-allow-unused-variables branch April 8, 2018 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use unimplemented! to reference variables, instead of allow(unused_variables)

2 participants