1CARGO-CLEAN(1) CARGO-CLEAN(1)
2
3
4
6 cargo-clean - Remove generated artifacts
7
9 cargo clean [OPTIONS]
10
12 Remove artifacts from the target directory that Cargo has generated in
13 the past.
14
15 With no options, cargo clean will delete the entire target directory.
16
18 Package Selection
19 When no packages are selected, all packages and all dependencies in the
20 workspace are cleaned.
21
22 -p SPEC..., --package SPEC...
23 Clean only the specified packages. This flag may be specified
24 multiple times. See cargo-pkgid(1) for the SPEC format.
25
26 Clean Options
27 --doc
28 This option will cause cargo clean to remove only the doc directory
29 in the target directory.
30
31 --release
32 Clean all artifacts that were built with the release or bench
33 profiles.
34
35 --target-dir DIRECTORY
36 Directory for all generated artifacts and intermediate files. May
37 also be specified with the CARGO_TARGET_DIR environment variable,
38 or the build.target-dir config value
39 <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults
40 to target in the root of the workspace.
41
42 --target TRIPLE
43 Clean for the given architecture. The default is the host
44 architecture. The general format of the triple is
45 <arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
46 a list of supported targets.
47
48 This may also be specified with the build.target config value
49 <https://doc.rust-lang.org/cargo/reference/config.html>.
50
51 Note that specifying this flag makes Cargo run in a different mode
52 where the target artifacts are placed in a separate directory. See
53 the build cache
54 <https://doc.rust-lang.org/cargo/guide/build-cache.html>
55 documentation for more details.
56
57 Display Options
58 -v, --verbose
59 Use verbose output. May be specified twice for "very verbose"
60 output which includes extra output such as dependency warnings and
61 build script output. May also be specified with the term.verbose
62 config value
63 <https://doc.rust-lang.org/cargo/reference/config.html>.
64
65 -q, --quiet
66 No output printed to stdout.
67
68 --color WHEN
69 Control when colored output is used. Valid values:
70
71 · auto (default): Automatically detect if color support is
72 available on the terminal.
73
74 · always: Always display colors.
75
76 · never: Never display colors.
77
78 May also be specified with the term.color config value
79 <https://doc.rust-lang.org/cargo/reference/config.html>.
80
81 Manifest Options
82 --manifest-path PATH
83 Path to the Cargo.toml file. By default, Cargo searches for the
84 Cargo.toml file in the current directory or any parent directory.
85
86 --frozen, --locked
87 Either of these flags requires that the Cargo.lock file is
88 up-to-date. If the lock file is missing, or it needs to be updated,
89 Cargo will exit with an error. The --frozen flag also prevents
90 Cargo from attempting to access the network to determine if it is
91 out-of-date.
92
93 These may be used in environments where you want to assert that the
94 Cargo.lock file is up-to-date (such as a CI build) or want to avoid
95 network access.
96
97 --offline
98 Prevents Cargo from accessing the network for any reason. Without
99 this flag, Cargo will stop with an error if it needs to access the
100 network and the network is not available. With this flag, Cargo
101 will attempt to proceed without the network if possible.
102
103 Beware that this may result in different dependency resolution than
104 online mode. Cargo will restrict itself to crates that are
105 downloaded locally, even if there might be a newer version as
106 indicated in the local copy of the index. See the cargo-fetch(1)
107 command to download dependencies before going offline.
108
109 May also be specified with the net.offline config value
110 <https://doc.rust-lang.org/cargo/reference/config.html>.
111
112 Common Options
113 -h, --help
114 Prints help information.
115
116 -Z FLAG...
117 Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
118 details.
119
121 See the reference
122 <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
123 for details on environment variables that Cargo reads.
124
126 0
127 Cargo succeeded.
128
129 101
130 Cargo failed to complete.
131
133 1. Remove the entire target directory:
134
135 cargo clean
136
137 2. Remove only the release artifacts:
138
139 cargo clean --release
140
142 cargo(1), cargo-build(1)
143
144
145
146 2019-09-05 CARGO-CLEAN(1)