Commit Graph

112 Commits

Author SHA1 Message Date
Andre Bogus
964dd9932b Added comment to explain second example 2017-01-01 05:26:33 +01:00
Andre Bogus
53b35444b6 new idiom: Default trait 2016-12-31 14:56:54 +01:00
Andre Bogus
d827cec092 Add another example to the mem::replace idiom
This fixes #38
2016-12-18 21:24:30 +01:00
Nick Cameron
67870c809f Merge pull request #30 from lfairy/small-crates
Prefer small crates
2016-10-25 08:27:36 +13:00
Chris Wong
bfd4b5c9b5 Address feedback from @nrc 2016-10-22 17:58:47 +13:00
Chris Wong
3c68655fab Merge pull request #40 from diwic/patch-1
Change "".to_string() to String::new()
2016-10-12 19:53:39 +13:00
diwic
5f484ad473 Change "".to_string() to String::new()
I mistakenly lost this change in my previous pull request, sorry!
2016-10-12 08:50:29 +02:00
Chris Wong
9d955043a4 Merge pull request #33 from partim/take-for-replace
Mention Option::take() as an alternative to mem::replace()
2016-10-10 21:58:42 +13:00
Martin Hoffmann
9fd6a8f9cf Fix language. 2016-10-10 10:52:57 +02:00
David Henningsson
3bec875bdc Merge remote-tracking branch 'dd/patch-1'
Conflicts:
	idioms/mem-replace.md
2016-10-10 08:10:49 +02:00
Nick Cameron
e5c792eb69 Merge pull request #37 from hoodie/master
fixed highlighting
2016-10-10 11:25:10 +13:00
Hendrik Sollich
41fa4d556a fixed highlighting 2016-10-10 00:18:32 +02:00
Chris Wong
26e27cd307 Merge pull request #32 from xfix/patch-1
Prepending _ to field name avoids unused field warning
2016-10-10 09:20:06 +13:00
Nick Cameron
283e410d0b Merge pull request #34 from CasualX/master
Fix a few nits.
2016-10-10 09:08:59 +13:00
diwic
490fb34bb2 Improve mem-replace example
Submitting a PR as suggested by llogiq [here](https://www.reddit.com/r/rust/comments/56l2pk/an_underused_idiom_memreplace_to_avoid_clones/d8kksx6)
2016-10-09 19:47:44 +02:00
CasualX
69de2351f2 Fix a few nits with the replace idiom.
Change the match guard to be part of the pattern.

Change `"".to_string()` to a more idiomatic `String::new()` to create a new `String` without memory allocation.
2016-10-09 15:35:57 +02:00
Martin Hoffmann
618a65c337 Mention Option::take() as an alternative to mem::replace() 2016-10-09 13:39:26 +02:00
Konrad Borowski
6af4003b88 Prepending _ to field name avoids unused field warning 2016-10-09 12:51:01 +02:00
Christopher
9b289ac6fc Merge pull request #31 from llogiq/mem-replace
new idiom: mem::replace
2016-10-08 12:19:44 -05:00
Andre Bogus
547ff18605 Adressed comments 2016-10-08 19:14:05 +02:00
Andre Bogus
31b282ad9f new idiom: mem::replace 2016-10-08 08:51:31 +02:00
Chris Wong
8a94ebc253 Replace "png" with "num_cpus" 2016-10-05 19:34:12 +13:00
Nick Cameron
3d748b1adc Merge pull request #25 from lfairy/option-list
Add "Treating Option like a list"
2016-09-30 09:37:10 +13:00
Chris Wong
f3fe2d6f28 Iterating over an Option 2016-09-29 23:52:13 +13:00
Chris Wong
a65d22ddc2 Direct contributors to the issue tracker 2016-09-29 11:39:56 +13:00
Mikhail Trishchenkov
1bc8a36a2f Small title fix 2016-09-27 16:01:35 +13:00
Mikhail Trishchenkov
67685cddf0 Rename idiom 2016-09-27 16:01:35 +13:00
Mikhail Trishchenkov
9f85aad151 Fix review issues
Replace tabs with spaces, mention usage for borrowing, add disadvantage
(code indentation increase).
2016-09-27 16:01:35 +13:00
Mikhail Trishchenkov
72606ccfcb Clone to closure idiom 2016-09-27 16:01:35 +13:00
Chris Wong
f4ae13a81e Small crates 2016-09-25 16:58:44 +13:00
Nick Cameron
f41b745acf Add the badly-named fold pattern 2016-01-06 10:47:07 +13:00
Nick Cameron
99b1342338 Visitor pattern 2015-12-09 14:00:17 +13:00
Nick Cameron
6ac851e718 Add the extensibility by privacy pattern
(And change the concatenation pattern to say something different about perf)
2015-12-09 10:59:30 +13:00
Nick Cameron
e708788268 Merge pull request #2 from nrc/structs
Composing structs
2015-11-12 10:55:30 +13:00
Nick Cameron
e340602f3f Composing structs 2015-11-12 10:54:36 +13:00
Nick Cameron
fd47bf3ba8 Merge pull request #18 from nrc/deref
Deref polymorphism anti-pattern
2015-11-01 21:32:13 -05:00
Nick Cameron
c2cf5e6c1a Deref polymorphism anti-pattern 2015-11-01 21:31:24 -05:00
Nick Cameron
a06ca32e70 Merge pull request #15 from liigo/patch-3
improve comment
2015-10-28 09:13:30 -04:00
Nick Cameron
e54514d35d Merge pull request #13 from liigo/patch-1
fix compile error in comment
2015-10-28 09:08:25 -04:00
liigo
d4fa321a38 improve comment 2015-10-28 09:09:57 +08:00
liigo
ea3aa4d310 fix compile error in comment 2015-10-28 09:04:38 +08:00
Nick Cameron
8a461ce5f6 Merge pull request #16 from oli-obk/patch-1
Result + try! is a pattern, unwrap() is not
2015-10-27 08:45:04 -04:00
Nick Cameron
d18cb4bd7e Merge pull request #14 from liigo/patch-2
improve comments
2015-10-27 08:43:49 -04:00
Oliver Schneider
d4f297e1d3 Result + try! is a pattern, unwrap() is not 2015-10-27 10:07:01 +01:00
Nick Cameron
11f2875a3b Merge pull request #12 from jsanders/patch-1
Fix typo in `.with_attribute` call.
2015-10-26 22:20:17 -04:00
Liigo Zhuang
0bdd88a94a improve comments 2015-10-27 09:31:41 +08:00
James Sanders
73c74caf14 Fix typo in .with_attribute call. 2015-10-26 15:11:14 -06:00
Nick Cameron
c638139abf Merge pull request #9 from aochagavia/patch-1
Fix typo
2015-10-24 09:21:48 +13:00
Nick Cameron
bb4cc1bfbd Merge pull request #10 from stevegury/patch-1
Fix a minor typo s/he/the/
2015-10-24 09:21:18 +13:00
Steve Gury
5bc7f3a99c Fix a minor typo s/he/the/ 2015-10-23 09:54:08 -07:00