Please don't take the Amazon star rating too serious - every lens has its pros and cons that I wouldn't want to squeeze into a single one-dimensional figure...
A quick note about me: I have been into SLR cameras and lenses for more than 20 years - as a hobby in the beginning and professionally later. Maybe because of my technical background I started testing my own lenses quite a while ago. I have a (no longer so) little test lab of my own where I do 6 different image quality tests (after taking a lens out for a while).
Canon's first-ever "pancake" EF lens is a real treat. It's so small that it looks like a 20 mm extension ring rather than a lens and yet it feels solid as a rock and delivers very respectable image quality. It comes with Canon's stepping motor technology (STM) that allows continuous AF during video recording or live-view mode (when used with a hybrid CMOS AF system) and that gives the lens a fast, silent and accurate autofocus performance. The EF 40mm f/2.8 STM is best used for street and travel photography but can also make great portraits or other things. Its maximum aperture of f/2.8 is great but not good enough for available light photography (which requires even lower f-stops i.e. wider apertures) and I would have loved to have an image stabilizer - but of course that would have been very difficult to build into a 2.7" x 0.9" (68 mm x 23 mm) lens.
In regard to image quality the EF 40mm f/2.8 STM is really a high-end lens. The difference is most apparent if you compare it to a zoom lens but also amongst prime lenses of similar focal length the EF 40mm f/2.8 STM is a high performer. The resolution is great straight from f/2.8 both in the image center and corners. If you use a fullframe camera the EF 50mm f/1.4 USM
is a little sharper and the EF 50mm f/1.8 II
is about as sharp as the EF 40mm f/2.8 STM (compared at the same aperture). But if you shoot with an APS-C camera the EF 40mm f/2.8 STM easily outperforms both of those lenses (apparently it can cope better with the usually higher pixel density of APS-C cameras). It is roughly as sharp as the APS-C-only EF-S 60mm f/2.8 Macro USM
(which is more than 3 times its size).
While the EF 40mm f/2.8 STM shows only very little distortion it does express some serious curvature of the focal plane ("field curvature") on a fullframe camera (none on an APS-C cam) but whether that's really visible in an actual image depends a lot on the subject you are shooting and the aperture you are using (the lab tests I am doing are close to the worst case so expect real life results to be better). Color fringes ("chromatic aberrations") in focused parts of the image ("transverse CA") are noticeable and so are the ones that occur in out-of-focus parts of the image ("axial CA"). On the good side, the nicely shaped aperture creates evenly smooth background blur but if you are bothered by corner shadows ("vignetting") be aware that the EF 40mm f/2.8 STM shows quite intense shadows up to about f/5.6 (with fullframe cameras).
Overall the image quality is quite astonishing for a lens that's as small as the EF 40mm f/2.8 STM and that comes at such a low price tag. This also means that from now on you can always have a decent f/2.8 prime lens with you that virtually needs no space in your camera bag!
Canon set out to create their first pancake EF lens and they did it the right way - combining great features with an incredibly small size at an acceptable price. I am sure many people will love the lens just for its size and the way it feels but even beyond that the EF 40mm f/2.8 STM has a lot to offer.
A much more detailed review of this lens together with all test shots, sample images and technical data is available on my website LensTests_com.