WD40 is a poor chain lubricant. It is mainly solvent, very little oil. After the solvent has evaporated, whatever little oil remains (so little that it won't last a long time) is not formulated to be a good chain lubricant.
Prevously, I have used thixotropic motorcycle chain lubricant in a spray can. Thixotropy means that when the lubricant is agitated, it becomes thin, when it is left settle, it becomes thick. When you shake the bottle and spray it, the lubricant is in the "thin" state, penetrating to the chain innards easily. When you leave the bike overnight, the lubricant thickens, preventing lubricant from dripping into your floor (important for me since I store my bike indoors). When you go and ride the bike, the lubricant becomes thin, reducing inefficiency of the drivetrain. When you park the bike again, it becomes thick. I have gotten 800 km out of a single lubrication run in dry conditions and about 4500 km out of a single chain (0.5% wear limit).
However, on my next chain I'll install soon I'm going to try a different lubricant (wet lubricant). It is the winner of the Zero Friction Cycling's Single Application Longevity test for dry road conditions. They got 5602 km out of a single application in a laboratory until the 0.1% wear limit is achieved, but they recognize that in real road conditions as opposed to a laboratory you get about third of that (1867 km). If I get 1867 km out of a single lubrication run, and if I get 5*1867 = 9335 km out of a single chain (0.5% wear limit), it's going to be a very good lubricant. I dropped few drops of the lubricant into a disposable shot glass and it seems very thin, so thin in fact that I'm suspicious whether it's going to be better than the thixotropic motorcycle chain lubricant from which I get 800 km out of a single application and 4500 km until the chain is 0.5% worn. Also it's so thin I have to carefully see whether it starts to drip on my floor.
I genuinely believe that the Single Application Longevity is the most important test that Zero Friction Cycling does. The reasoning is that you should never lubricate a dirty chain (because otherwise the lubrication carries external non-harmful dirt to the chain innards where it can actually do harm). Thus, when you lubricate a chain you need to devote at least 20 minutes to get it reasonably clean (if you don't then the chain will start wearing very quickly). If your time has any value, these minutes spent in cleaning the chain are the costliest component of chain maintenance, far exceeding the cost of the chain lubricant (no matter how expensive) or the cost of the chain itself. Therefore, you want to minimize the time spent in chain cleaning, and you do that by selecting a lubricant that gives as many kilometers as possible out of a single application.
In Zero Friction Cycling tests, wax shows very low chain wear. However, it needs to be applied more often than the best wet lubricant they have tested, and the lubrication process when using wax is time-consuming, taking so much time that it isn't worth it, unless your time has no value so the only cost component of chain wear is the cost of the chain.
Dust does stick to all wet lubricants. It doesn't mean you shouldn't use a wet lubricant. After lubricating the chain, you should wipe away the excess lubricant from the outside, minimizing the lubricant film thickness on the outside and minimizing the amount of dust sticking to your chain. The lubricant doing its real job is inside the chain half-bushings and around the chain pins. Some minimal amount of dust does indeed stick to the small lubricant film on the outside of the chain (since you can't get it fully dry of lubricant by wiping, and even if you could, there's a possibility some lubricant from the chain innards can exit the innards and re-coat the exterior of the chain). But before re-lubricating the chain, you clean the chain externally, removing this non-harmful dirt from the exterior of the chain that would become harmful by entering the chain innards should you lubricate an externally dirty chain.