Skip to content

Commit 7afb457

Browse files
committed
Cleanup code and update workflow
1 parent 83603f6 commit 7afb457

File tree

11 files changed

+22
-47
lines changed

11 files changed

+22
-47
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- uses: actions-rs/cargo@v1
3939
with:
4040
command: doc
41-
args: -p cairo-rs -p cairo-sys-rs -p gdk-pixbuf -p gdk-pixbuf-sys -p gio -p gio-sys -p glib -p gobject-sys -p glib-sys -p glib-macros -p glib-build-tools -p graphene-rs -p graphene-sys -p pango -p pango-sys -p pangocairo -p pangocairo-sys --no-deps
41+
args: -p cairo-rs -p cairo-sys-rs -p gdk-pixbuf -p gdk-pixbuf-sys -p gio -p gio-sys -p glib -p gobject-sys -p glib-sys -p glib-macros -p glib-build-tools -p graphene-rs -p graphene-sys -p pango -p pango-sys -p pangocairo -p pangocairo-sys --no-deps --all-features
4242
- run: echo "RELEASE=$(echo '${{ github.event.release.tag_name }}' | grep -Po '(\d+)\.(\d+)')" >> ${GITHUB_ENV}
4343
- run: echo "DEST=$(if [ "$GITHUB_EVENT_NAME" == "release" ]; then echo 'stable/${{ env.RELEASE }}'; else echo 'git'; fi)" >> ${GITHUB_ENV}
4444
- name: Grab gtk-rs LOGO

cairo/src/constants.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ pub const MIME_TYPE_JBIG2: &str = "application/x-cairo.jbig2";
99
pub const MIME_TYPE_JBIG2_GLOBAL: &str = "application/x-cairo.jbig2-global";
1010
pub const MIME_TYPE_JBIG2_GLOBAL_ID: &str = "application/x-cairo.jbig2-global-id";
1111
#[cfg(feature = "v1_16")]
12-
#[cfg_attr(docsrs, cfg(doc(feature = "v1_16")))]
12+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1313
pub const MIME_TYPE_CCITT_FAX: &str = "image/g3fax";
1414
#[cfg(feature = "v1_16")]
15-
#[cfg_attr(docsrs, cfg(doc(feature = "v1_16")))]
15+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1616
pub const MIME_TYPE_CCITT_FAX_PARAMS: &str = "application/x-cairo.ccitt.params";
1717
#[cfg(feature = "v1_16")]
18-
#[cfg_attr(docsrs, cfg(doc(feature = "v1_16")))]
18+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
1919
pub const MIME_TYPE_EPS: &str = "application/postscript";
2020
#[cfg(feature = "v1_16")]
21-
#[cfg_attr(docsrs, cfg(doc(feature = "v1_16")))]
21+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
2222
pub const MIME_TYPE_EPS_PARAMS: &str = "application/x-cairo.eps.params";
2323

2424
#[cfg(feature = "v1_16")]
25-
#[cfg_attr(docsrs, cfg(doc(feature = "v1_16")))]
25+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
2626
pub const PDF_OUTLINE_ROOT: i32 = 0;
2727

2828
#[cfg(feature = "v1_16")]
29-
#[cfg_attr(docsrs, cfg(doc(feature = "v1_16")))]
29+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
3030
pub const CAIRO_TAG_DEST: &str = "cairo.dest";
3131
#[cfg(feature = "v1_16")]
32-
#[cfg_attr(docsrs, cfg(doc(feature = "v1_16")))]
32+
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
3333
pub const CAIRO_TAG_LINK: &str = "Link";

cairo/src/context.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl fmt::Display for RectangleList {
6464
pub struct Context(ptr::NonNull<cairo_t>);
6565

6666
#[cfg(feature = "use_glib")]
67-
#[cfg_attr(docsrs, cfg(doc(feature = "use_glib")))]
67+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
6868
impl IntoGlibPtr<*mut ffi::cairo_t> for Context {
6969
#[inline]
7070
unsafe fn into_glib_ptr(self) -> *mut ffi::cairo_t {
@@ -73,7 +73,7 @@ impl IntoGlibPtr<*mut ffi::cairo_t> for Context {
7373
}
7474

7575
#[cfg(feature = "use_glib")]
76-
#[cfg_attr(docsrs, cfg(doc(feature = "use_glib")))]
76+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
7777
impl<'a> ToGlibPtr<'a, *mut ffi::cairo_t> for &'a Context {
7878
type Storage = PhantomData<&'a Context>;
7979

@@ -89,7 +89,7 @@ impl<'a> ToGlibPtr<'a, *mut ffi::cairo_t> for &'a Context {
8989
}
9090

9191
#[cfg(feature = "use_glib")]
92-
#[cfg_attr(docsrs, cfg(doc(feature = "use_glib")))]
92+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
9393
impl FromGlibPtrNone<*mut ffi::cairo_t> for Context {
9494
#[inline]
9595
unsafe fn from_glib_none(ptr: *mut ffi::cairo_t) -> Context {
@@ -98,7 +98,7 @@ impl FromGlibPtrNone<*mut ffi::cairo_t> for Context {
9898
}
9999

100100
#[cfg(feature = "use_glib")]
101-
#[cfg_attr(docsrs, cfg(doc(feature = "use_glib")))]
101+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
102102
impl FromGlibPtrBorrow<*mut ffi::cairo_t> for Context {
103103
#[inline]
104104
unsafe fn from_glib_borrow(ptr: *mut ffi::cairo_t) -> crate::Borrowed<Context> {
@@ -107,7 +107,7 @@ impl FromGlibPtrBorrow<*mut ffi::cairo_t> for Context {
107107
}
108108

109109
#[cfg(feature = "use_glib")]
110-
#[cfg_attr(docsrs, cfg(doc(feature = "use_glib")))]
110+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
111111
impl FromGlibPtrFull<*mut ffi::cairo_t> for Context {
112112
#[inline]
113113
unsafe fn from_glib_full(ptr: *mut ffi::cairo_t) -> Context {
@@ -116,7 +116,6 @@ impl FromGlibPtrFull<*mut ffi::cairo_t> for Context {
116116
}
117117

118118
#[cfg(feature = "use_glib")]
119-
#[cfg_attr(docsrs, cfg(doc(feature = "use_glib")))]
120119
gvalue_impl!(
121120
Context,
122121
cairo_t,

cairo/src/device.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ impl Device {
314314
}
315315

316316
#[cfg(feature = "use_glib")]
317-
#[cfg_attr(docsrs, cfg(doc(feature = "use_glib")))]
317+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
318318
impl IntoGlibPtr<*mut ffi::cairo_device_t> for Device {
319319
#[inline]
320320
unsafe fn into_glib_ptr(self) -> *mut ffi::cairo_device_t {
@@ -323,7 +323,7 @@ impl IntoGlibPtr<*mut ffi::cairo_device_t> for Device {
323323
}
324324

325325
#[cfg(feature = "use_glib")]
326-
#[cfg_attr(docsrs, cfg(doc(feature = "use_glib")))]
326+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
327327
impl<'a> ToGlibPtr<'a, *mut ffi::cairo_device_t> for Device {
328328
type Storage = PhantomData<&'a Device>;
329329

@@ -339,7 +339,7 @@ impl<'a> ToGlibPtr<'a, *mut ffi::cairo_device_t> for Device {
339339
}
340340

341341
#[cfg(feature = "use_glib")]
342-
#[cfg_attr(docsrs, cfg(doc(feature = "use_glib")))]
342+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
343343
impl FromGlibPtrNone<*mut ffi::cairo_device_t> for Device {
344344
#[inline]
345345
unsafe fn from_glib_none(ptr: *mut ffi::cairo_device_t) -> Device {
@@ -348,7 +348,7 @@ impl FromGlibPtrNone<*mut ffi::cairo_device_t> for Device {
348348
}
349349

350350
#[cfg(feature = "use_glib")]
351-
#[cfg_attr(docsrs, cfg(doc(feature = "use_glib")))]
351+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
352352
impl FromGlibPtrBorrow<*mut ffi::cairo_device_t> for Device {
353353
#[inline]
354354
unsafe fn from_glib_borrow(ptr: *mut ffi::cairo_device_t) -> crate::Borrowed<Device> {
@@ -357,7 +357,7 @@ impl FromGlibPtrBorrow<*mut ffi::cairo_device_t> for Device {
357357
}
358358

359359
#[cfg(feature = "use_glib")]
360-
#[cfg_attr(docsrs, cfg(doc(feature = "use_glib")))]
360+
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
361361
impl FromGlibPtrFull<*mut ffi::cairo_device_t> for Device {
362362
#[inline]
363363
unsafe fn from_glib_full(ptr: *mut ffi::cairo_device_t) -> Device {
@@ -366,7 +366,6 @@ impl FromGlibPtrFull<*mut ffi::cairo_device_t> for Device {
366366
}
367367

368368
#[cfg(feature = "use_glib")]
369-
#[cfg_attr(docsrs, cfg(doc(feature = "use_glib")))]
370369
gvalue_impl!(
371370
Device,
372371
ffi::cairo_device_t,

cairo/src/enums.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,6 @@ impl From<FontType> for ffi::cairo_font_type_t {
10051005
FontType::FontTypeQuartz => ffi::FONT_TYPE_FONT_TYPE_QUARTZ,
10061006
FontType::FontTypeUser => ffi::FONT_TYPE_FONT_TYPE_USER,
10071007
#[cfg(feature = "v1_18")]
1008-
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18", docsrs)))]
10091008
FontType::FontTypeDwrite => ffi::FONT_TYPE_FONT_TYPE_DWRITE,
10101009
FontType::__Unknown(value) => value,
10111010
}
@@ -1022,7 +1021,6 @@ impl From<ffi::cairo_font_type_t> for FontType {
10221021
ffi::FONT_TYPE_FONT_TYPE_QUARTZ => Self::FontTypeQuartz,
10231022
ffi::FONT_TYPE_FONT_TYPE_USER => Self::FontTypeUser,
10241023
#[cfg(feature = "v1_18")]
1025-
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18", docsrs)))]
10261024
ffi::FONT_TYPE_FONT_TYPE_DWRITE => Self::FontTypeDwrite,
10271025
value => Self::__Unknown(value),
10281026
}
@@ -1041,7 +1039,6 @@ impl fmt::Display for FontType {
10411039
Self::FontTypeQuartz => "FontTypeQuartz",
10421040
Self::FontTypeUser => "FontTypeUser",
10431041
#[cfg(feature = "v1_18")]
1044-
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18", docsrs)))]
10451042
Self::FontTypeDwrite => "FontTypeDwrite",
10461043
_ => "Unknown",
10471044
}
@@ -1116,7 +1113,6 @@ impl fmt::Display for SubpixelOrder {
11161113
}
11171114

11181115
#[cfg(feature = "use_glib")]
1119-
#[cfg_attr(docsrs, cfg(doc(feature = "use_glib")))]
11201116
gvalue_impl!(
11211117
SubpixelOrder,
11221118
ffi::gobject::cairo_gobject_subpixel_order_get_type
@@ -1186,7 +1182,6 @@ impl fmt::Display for HintStyle {
11861182
}
11871183

11881184
#[cfg(feature = "use_glib")]
1189-
#[cfg_attr(docsrs, cfg(doc(feature = "use_glib")))]
11901185
gvalue_impl!(HintStyle, ffi::gobject::cairo_gobject_hint_style_get_type);
11911186

11921187
#[derive(Clone, PartialEq, Eq, PartialOrd, Debug, Copy)]
@@ -1243,7 +1238,6 @@ impl fmt::Display for HintMetrics {
12431238
}
12441239

12451240
#[cfg(feature = "use_glib")]
1246-
#[cfg_attr(docsrs, cfg(doc(feature = "use_glib")))]
12471241
gvalue_impl!(
12481242
HintMetrics,
12491243
ffi::gobject::cairo_gobject_hint_metrics_get_type
@@ -1413,7 +1407,6 @@ impl fmt::Display for SurfaceType {
14131407
}
14141408

14151409
#[cfg(feature = "use_glib")]
1416-
#[cfg_attr(docsrs, cfg(doc(feature = "use_glib")))]
14171410
gvalue_impl!(
14181411
SurfaceType,
14191412
ffi::gobject::cairo_gobject_surface_type_get_type
@@ -1589,7 +1582,6 @@ impl fmt::Display for Format {
15891582
}
15901583

15911584
#[cfg(feature = "use_glib")]
1592-
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
15931585
gvalue_impl!(Format, ffi::gobject::cairo_gobject_format_get_type);
15941586

15951587
impl Format {
@@ -1661,7 +1653,6 @@ impl fmt::Display for RegionOverlap {
16611653
}
16621654

16631655
#[cfg(feature = "use_glib")]
1664-
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
16651656
gvalue_impl!(
16661657
RegionOverlap,
16671658
ffi::gobject::cairo_gobject_region_overlap_get_type
@@ -1790,10 +1781,8 @@ impl From<PdfVersion> for ffi::cairo_pdf_version_t {
17901781
PdfVersion::_1_4 => ffi::PDF_VERSION__1_4,
17911782
PdfVersion::_1_5 => ffi::PDF_VERSION__1_5,
17921783
#[cfg(feature = "v1_18")]
1793-
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
17941784
PdfVersion::_1_6 => ffi::PDF_VERSION__1_6,
17951785
#[cfg(feature = "v1_18")]
1796-
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
17971786
PdfVersion::_1_7 => ffi::PDF_VERSION__1_7,
17981787
PdfVersion::__Unknown(value) => value,
17991788
}
@@ -1809,10 +1798,8 @@ impl From<ffi::cairo_pdf_version_t> for PdfVersion {
18091798
ffi::PDF_VERSION__1_4 => Self::_1_4,
18101799
ffi::PDF_VERSION__1_5 => Self::_1_5,
18111800
#[cfg(feature = "v1_18")]
1812-
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
18131801
ffi::PDF_VERSION__1_6 => Self::_1_6,
18141802
#[cfg(feature = "v1_18")]
1815-
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
18161803
ffi::PDF_VERSION__1_7 => Self::_1_7,
18171804
value => Self::__Unknown(value),
18181805
}
@@ -1830,10 +1817,8 @@ impl fmt::Display for PdfVersion {
18301817
Self::_1_4 => "1_4",
18311818
Self::_1_5 => "1_5",
18321819
#[cfg(feature = "v1_18")]
1833-
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
18341820
Self::_1_6 => "1_6",
18351821
#[cfg(feature = "v1_18")]
1836-
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
18371822
Self::_1_7 => "1_7",
18381823
_ => "Unknown",
18391824
}
@@ -2207,7 +2192,6 @@ impl fmt::Display for DeviceType {
22072192
}
22082193

22092194
#[cfg(feature = "use_glib")]
2210-
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
22112195
gvalue_impl!(DeviceType, ffi::gobject::cairo_gobject_device_type_get_type);
22122196

22132197
#[cfg(test)]

cairo/src/error.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,8 @@ impl From<Error> for ffi::cairo_status_t {
194194
Error::FreetypeError => ffi::STATUS_FREETYPE_ERROR,
195195
Error::Win32GdiError => ffi::STATUS_WIN32_GDI_ERROR,
196196
#[cfg(feature = "v1_16")]
197-
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
198197
Error::TagError => ffi::STATUS_TAG_ERROR,
199198
#[cfg(feature = "v1_18")]
200-
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
201199
Error::DwriteError => ffi::STATUS_DWRITE_ERROR,
202200
Error::LastStatus => ffi::STATUS_LAST_STATUS,
203201
Error::__Unknown(value) => value,
@@ -251,10 +249,8 @@ impl From<ffi::cairo_status_t> for Error {
251249
ffi::STATUS_FREETYPE_ERROR => Self::FreetypeError,
252250
ffi::STATUS_WIN32_GDI_ERROR => Self::Win32GdiError,
253251
#[cfg(feature = "v1_16")]
254-
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
255252
ffi::STATUS_TAG_ERROR => Self::TagError,
256253
#[cfg(feature = "v1_18")]
257-
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
258254
ffi::STATUS_DWRITE_ERROR => Self::DwriteError,
259255
ffi::STATUS_LAST_STATUS => Self::LastStatus,
260256
value => Self::__Unknown(value),

cairo/src/font/font_face.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use crate::{utils::status_to_result, Error, FontSlant, FontType, FontWeight};
1717
static FT_FACE_KEY: crate::UserDataKey<freetype::face::Face> = crate::UserDataKey::new();
1818

1919
#[cfg(feature = "use_glib")]
20-
#[cfg_attr(docsrs, doc(cfg(feature = "use_glib")))]
2120
glib::wrapper! {
2221
#[derive(Debug)]
2322
#[doc(alias = "cairo_font_face_t")]

cairo/sys/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#![allow(clippy::unreadable_literal)]
55
#![allow(clippy::write_literal)]
66
#![allow(clippy::upper_case_acronyms)]
7+
#![cfg_attr(docsrs, feature(doc_cfg))]
78

89
extern crate libc;
910

@@ -14,15 +15,15 @@ extern crate x11;
1415
extern crate winapi as winapi_orig;
1516

1617
#[cfg(all(windows, feature = "win32-surface"))]
17-
#[cfg_attr(docsrs, cfg(doc(all(windows, feature = "win32-surface"))))]
18+
#[cfg_attr(docsrs, doc(cfg(all(windows, feature = "win32-surface"))))]
1819
pub mod winapi {
1920
pub use winapi_orig::shared::windef::HDC;
2021
}
2122

2223
#[cfg(all(docsrs, not(all(windows, feature = "win32-surface"))))]
2324
#[cfg_attr(
2425
docsrs,
25-
cfg(doc(all(docsrs, not(all(windows, feature = "win32-surface")))))
26+
doc(cfg(all(docsrs, not(all(windows, feature = "win32-surface")))))
2627
)]
2728
pub mod winapi {
2829
use libc::c_void;

gio/src/file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{Cancellable, File, FileCreateFlags, FileEnumerator, FileQueryInfoFla
1212

1313
impl File {
1414
#[cfg(feature = "v2_74")]
15-
#[_attr(docsrs, doc(cfgcfg(feature = "v2_74")))]
15+
#[cfg_attr(docsrs, doc(cfg(feature = "v2_74")))]
1616
#[doc(alias = "g_file_new_tmp_async")]
1717
pub fn new_tmp_async<P: FnOnce(Result<(File, FileIOStream), glib::Error>) + 'static>(
1818
tmpl: Option<impl AsRef<std::path::Path>>,

pango/src/attr_float.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ define_attribute_struct!(
1010
&[
1111
AttrType::Scale,
1212
#[cfg(feature = "v1_50")]
13-
#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
1413
AttrType::LineHeight
1514
]
1615
);

0 commit comments

Comments
 (0)