Uh oh!
There was an error while loading. Please reload this page.
Show impl for RefCell - #14883
Conversation
lilyball
commented
Jun 14, 2014
I don't think it's appropriate to have |
forticulous
commented
Jun 14, 2014
I think Also this impl doesn't fail, the test makes sure it doesn't. If you mean it might print out something different depending on the state of What it displays when the refcell is already borrowed can easily be changed. I was thinking either show nothing or some kind of message saying it's already borrowed, and the latter is less confusing so I went with that |
lilyball
commented
Jun 14, 2014
Ok yes, this isn't failure in the sense of task failure. but it is failure in the sense that it's unexpectedly showing useless information. |
forticulous
commented
Jun 14, 2014
The other option would be something like this: matchself.try_borrow(){Some(_) => (*self.borrow()).fmt(f),None => Err(WriteError)} |
lilyball
commented
Jun 14, 2014
Well, this is why I think it's better to let the client figure out how to handle dynamic borrow failures. Which means let them write |
forticulous
commented
Jun 14, 2014
Incidentally it would be nice if there were another implementation of |
forticulous
commented
Jun 18, 2014
@alexcrichton What do you think? |
alexcrichton
commented
Jun 18, 2014
I agree, |
forticulous
commented
Jun 18, 2014
The |
forticulous
commented
Jun 18, 2014
Also, I agree that users may want to override it to suit their needs, but there should be some default implementation. Otherwise the only way to print out a complex datastructure with |
lilyball
commented
Jun 18, 2014
@forticulous The error result from Which is to say, using Show to write to an in-memory buffer should never fail. |
alexcrichton
commented
Jun 18, 2014
If the |
changelog: none This tries to make progress on rust-lang#78717 by using the ui_test dependency handling instead of linking in the dependencies of clippy itself with the tests. This partially reverts rust-lang/rust-clippy#11045. However, we still use the old style of dealing with dependencies for clippy's own crates and the "internal" tests, as otherwise those would get rebuilt which takes too long.
Safe
Showimpl forRefCell.I'm open to debate about how to handle the case where
try_borrow()fails. I went with displaying that the refcell is borrowed to minimize surprises